Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The safe way to automate Valheim restarts is to let a process supervisor own the server, send a graceful stop signal equivalent to pressing CTRL+C, wait for the process to exit, and then start it again. On Linux, use a systemd service plus a timer; on Windows, use a service or Task Scheduler wrapper that can deliver a console-control stop; in Docker, use the image’s restart and backup variables. Treat planned maintenance restarts separately from crash recovery, and test one complete stop, start, save, backup, and client reconnection before enabling a recurring schedule.

Iron Gate’s dedicated-server instructions warn that closing the console with the window’s X can leave the server running in the background. A scheduler that merely kills a process can therefore risk an incomplete save or a second copy starting against the same world. The procedures below make the stop phase explicit and verifiable.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What an automatic Valheim restart must do

A restart is not just a new process launch. A reliable cycle has four distinct phases:

  1. Announce or choose a maintenance window. Pick a low-use time and record the host timezone.
  2. Stop gracefully. Iron Gate says to stop the dedicated server by pressing CTRL+C in its command window. On Linux, configure the supervisor to send SIGINT, the signal equivalent used by the service wrapper.
  3. Wait for exit. The scheduler must not launch a second server while the first process is still flushing world data.
  4. Start and verify. Read the service or container log, confirm the expected world loaded and the listening messages appeared, then connect with a client.

Use a supervisor for this lifecycle. A supervisor also starts the server after a host reboot and can restart it after an abnormal exit. A planned timer, cron entry, or container schedule remains necessary for routine maintenance.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Choose the right implementation

Option Graceful-stop control Planned schedule Backup and idle-player features Updates and logs Best fit
Linux systemd KillSignal=SIGINT lets systemd perform a stop-and-wait cycle; TimeoutStopSec limits the wait. systemd timer or cron runs systemctl restart. Backups and idle checks are separate scripts or jobs; no built-in values are established here. Journal logs and unit status are integrated. Update logic is external. Operators who want precise process ownership and lifecycle controls.
Windows service or Task Scheduler A wrapper must send a console-control stop equivalent to CTRL+C, wait for valheim_server.exe to exit, and only then launch it. Task Scheduler trigger or the service wrapper’s schedule. Use separate backup and idle-player logic; built-in behavior depends on the wrapper. Write dated stdout/stderr logs and alert on a nonzero exit. Updates are external. Windows hosts already managed with Task Scheduler or service tooling.
Docker with community-valheim-tools The image documents shutdown hooks and container restart handling; inspect its logs to confirm the hook completed. RESTART_CRON, with optional RESTART_IF_IDLE=true. BACKUPS, BACKUPS_CRON, retention settings, and an external backup directory are documented. Update checks can be configured and may trigger a restart; container logs show the sequence. Operators who prefer environment-variable configuration and built-in backup scheduling.

Whichever option you choose, give it one owner for planned restarts. Do not run a systemd timer, a cron entry, and a container schedule against the same server unless you deliberately coordinate them.

Linux: configure systemd and a maintenance timer

1. Prepare a dedicated account and stable paths

Run the server as a dedicated account rather than as root. Place the copied launch script in a directory that will not move during updates, and keep world data and backups explicit. For example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo useradd --system --home /opt/valheim --shell /usr/sbin/nologin valheim
sudo install -d -o valheim -g valheim /opt/valheim
sudo install -d -o valheim -g valheim /srv/valheim/worlds
sudo install -d -o valheim -g valheim /srv/valheim/backups

Place your maintained start_headless_server.sh in /opt/valheim. It should launch the copied Valheim server in the foreground, not fork into the background, and should contain the same world name, password, ports, mods, and -savedir options you use when starting manually. Keeping those options in one script prevents the scheduler and your hand-run command from drifting apart.

2. Create the service unit

Create /etc/systemd/system/valheim.service:

[Unit]
Description=Valheim dedicated server
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=valheim
Group=valheim
WorkingDirectory=/opt/valheim
ExecStart=/opt/valheim/start_headless_server.sh
KillSignal=SIGINT
TimeoutStopSec=120
Restart=on-failure
RestartSec=15

[Install]
WantedBy=multi-user.target

KillSignal=SIGINT mirrors the official Ctrl+C stop action. systemd waits for the service to stop, subject to TimeoutStopSec, before completing a restart. The 120-second value is an example ceiling; increase it if your world or mod set demonstrably needs longer, rather than allowing an overlapping launch. Restart=on-failure handles an unexpected crash. It does not create a daily maintenance schedule.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

If you use an ExecStop command instead, it must be a synchronous stop operation that waits for the server to finish. A command that merely sends a signal and returns immediately can let the start phase race the old process. Do not substitute a forced kill for the graceful signal.

3. Enable and manually test the service

sudo systemctl daemon-reload
sudo systemctl enable --now valheim.service
sudo systemctl status valheim.service
sudo journalctl -u valheim.service -f

Before adding any timer, run a complete manual restart:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl restart valheim.service
sudo systemctl status valheim.service
sudo journalctl -u valheim.service --since "10 minutes ago"

In the journal, look for a clean shutdown followed by world-load and listening messages. Confirm that the old process exited before the new start, connect with a client, and inspect the world and permissions. If the manual cycle fails, automation will only repeat the failure.

4. Add a systemd timer for planned maintenance

Create /etc/systemd/system/valheim-maintenance.service:

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
[Unit]
Description=Planned Valheim maintenance restart

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart valheim.service

Then create /etc/systemd/system/valheim-maintenance.timer:

[Unit]
Description=Daily Valheim maintenance restart

[Timer]
OnCalendar=*-*-* 05:10:00
Persistent=false
Unit=valheim-maintenance.service

[Install]
WantedBy=timers.target

The example runs at 05:10 in the host’s local timezone. Select a window your players understand, and do not overlap update, migration, or backup jobs. Persistent=false avoids an unexpected catch-up restart immediately after a long outage; choose a catch-up policy deliberately if your operation requires one.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl daemon-reload
sudo systemctl enable --now valheim-maintenance.timer
systemctl list-timers valheim-maintenance.timer
systemctl status valheim-maintenance.timer

At the first scheduled run, inspect both units and the journal. Check the service’s process start time, world-load messages, and a real client connection. Record the timer’s timezone so a daylight-saving change does not move the maintenance window without warning.

Docker: schedule restarts with the image settings

The community-valheim-tools image documents environment variables for planned restarts, idle checks, backups, timezone handling, hooks, and update checks. Set them in the container definition rather than typing a one-off command on the host.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Core variables

  • TZ: set an explicit timezone. A cron expression without a declared timezone is easy to misread after a host or daylight-saving change.
  • RESTART_CRON: the cron expression for the planned restart, such as 10 5 * * * for 05:10 every day in the configured timezone.
  • RESTART_IF_IDLE=true: restart only when no players are connected, if that policy suits your community. Idle-only behavior can postpone maintenance indefinitely on a continuously occupied server, so still monitor whether an update is waiting.
  • BACKUPS=true and BACKUPS_CRON: enable and schedule the image’s backup process, then set retention deliberately.

Keep the backup destination outside worlds_local. The image documentation warns that a backup directory inside that tree can be recursively included in later backups, growing the backup set and obscuring which copy is authoritative. Mount world data and backups on reliable storage, preferably on different volumes or hosts when the world is important.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Hooks, updates, and first-run validation

Use pre-shutdown and post-shutdown hooks only for commands that can finish within the image’s documented shutdown window. Read container logs for hook failures; a hook that hangs or exits unsuccessfully can change the timing of the restart. If update checks are enabled, treat the update and restart as one maintenance event: verify the server, world, and mods after the new image or server files are active.

  1. Set TZ, one RESTART_CRON window, and the backup variables in the container configuration.
  2. Start the container and confirm the server process remains in the foreground from the container’s perspective.
  3. Trigger one manual container restart during a maintenance window.
  4. Check for a graceful shutdown, a new process, world-load messages, and current backup timestamps.
  5. Connect with a client and confirm the expected world, characters, permissions, and mod behavior.

Windows: use a controlled wrapper, not a forced task kill

Iron Gate specifically warns that closing the console window with X may leave the server running in the background. A Task Scheduler task must therefore own a controlled stop/start sequence. The wrapper or Windows service you select needs to deliver a console-control stop equivalent to Ctrl+C, wait until valheim_server.exe has exited, and then launch your maintained start_headless_server.bat or PowerShell launcher. Do not use taskkill /F as the normal restart path; it is a forced termination, not a graceful save.

Task Scheduler procedure

  1. Open Task Scheduler and choose Create Task, not the simplified basic-task wizard if you need explicit recovery and logging controls.
  2. On General, select an account that has access to the Valheim files and world directory. Enable Run whether user is logged on or not when the host is unattended.
  3. On Triggers, add a daily trigger at a low-use time. Record the selected timezone and account for daylight-saving changes.
  4. On Actions, launch the wrapper that performs graceful stop, waits for process exit, starts the maintained launch script, and writes dated stdout/stderr logs.
  5. On Settings, allow the task to be started on demand and configure a failure action or alert for a nonzero exit. Do not configure overlapping instances.
  6. Run the task manually once. Confirm the old process exits, the new process starts, the log contains a clean shutdown and world load, and a client can reconnect.

If your chosen wrapper cannot send a console-control event and wait for exit, it is not suitable for unattended restarts. Use a Windows service wrapper that exposes those controls or keep the restart manual; a forced process termination is more likely to leave a world in an uncertain state.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Save cadence, backups, and the save directory

Automatic saves and graceful shutdown protect different failure windows. A restart should remain graceful even when autosaves are frequent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Launch option Documented default Meaning
-saveinterval 1800 1,800 seconds (30 minutes), documented by Iron Gate AB in 2024 Interval between automatic world saves; configurable.
-backups 4 Four automatic backups Number of automatic backup copies retained by the server; configurable.
-backupshort 7200 7,200 seconds (2 hours) Short backup interval; configurable.
-backuplong 43200 43,200 seconds (12 hours) Long backup interval; configurable.

These are documented defaults, not a guarantee that every installation has identical files or timing. Keep a separate operational backup in addition to the server’s rolling copies when the world matters, and test that you can identify and restore a known-good copy.

On Linux, Iron Gate documents the default save location as ~/.config/unity3d/IronGate/Valheim. The -savedir option lets you place worlds, permission files, and related data elsewhere. Use an explicit directory in your launch script so systemd, Docker mounts, backup jobs, and human operators all reference the same data.

Updating without turning maintenance into downtime chaos

Do not combine an update, a restart, and a backup for the first time during a busy play period. Schedule them as one maintenance event, and leave enough time to inspect logs and roll back the changed server or mod files if the world does not load.

  • Finish or pause external backup jobs before the stop begins; never copy a world while a forced process termination is still writing it.
  • Keep the launch script, world name, save directory, ports, password, and mod configuration under version control or in a documented, reproducible location.
  • After an update, check for mod-load errors, world-load completion, listening sockets, and a client connection. A process that is technically running can still be unusable because a mod or permission file failed.
  • Do not let an update checker and a separate timer restart the same instance simultaneously. Pick one maintenance owner.

Verification checklist for every new schedule

  1. Run one manual restart before enabling recurrence.
  2. Confirm the stop signal is graceful and the process exits before a start is attempted.
  3. Confirm the service or container reports healthy and running.
  4. Read logs for clean shutdown, world load, and listening or server-connected messages.
  5. Connect a client and verify the expected world, characters, permissions, and mods.
  6. Check that a new world-file or backup timestamp exists in the intended storage location.
  7. Record the timezone and exact schedule, including how daylight-saving changes are handled.
  8. Only simulate a failure in a maintenance window when you have a rollback plan; otherwise rely on staged restarts and log monitoring.

Troubleshooting common restart failures

Symptom Likely cause Action
A second server starts or the port is already in use. The stop command returned before the original process exited, or closing the console left a background process. Inspect the process list and logs, stop the orphan gracefully, increase the supervisor’s stop timeout if justified, and ensure the launcher stays in the foreground.
The service is running but the wrong world appears. The scheduled launcher uses different world or -savedir arguments than the manual launcher. Move all launch options into one maintained script and compare its account, working directory, and save path with the expected installation.
Backups grow rapidly or contain nested backup trees. The backup destination is inside Docker’s worlds_local directory. Move backups to a separate mounted directory and set retention explicitly.
The timer runs at an unexpected local time. The host timezone or daylight-saving rule differs from the operator’s assumption. Set Docker’s TZ or document the systemd/Windows host timezone, then inspect the next-run time before enabling recurrence.
A crash restarts the server, but the daily restart never occurs. Restart=on-failure (or a container restart policy) handles crashes only; no planned timer is active. Enable and inspect the separate maintenance timer or RESTART_CRON configuration.
The process starts after an update but clients cannot join. A mod, permission file, port, or world-load step failed even though the process remained alive. Read the complete startup log, compare the launch script with the last known-good version, and roll back the changed component before reopening the server.

Operational rule of thumb

Use systemd when you need the clearest Linux process lifecycle and journal visibility, Docker when you want documented restart, idle-player, backup, and timezone variables in one image, and Windows Task Scheduler or a service wrapper when the host is Windows. In all three cases, the non-negotiable sequence is the same: graceful stop, confirmed exit, start, log inspection, client reconnection, and backup verification. A schedule is only safe after that sequence has succeeded manually.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.