Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Blog

How to Schedule Node.js Cron Jobs on a Linux VPS

A practical guide to scheduling Node.js on a Linux VPS: install standalone jobs with crontab, choose node-cron or PM2 when appropriate, and avoid path, reboot, timezone and duplicate-run failures.
Length13 min Posted Quest giverVGSources Team

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.

For a Node.js task that should run independently every minute, hour, or day, put an explicit command in the target user’s crontab with crontab -e. Use absolute paths to Node and your script, set the working directory and environment yourself, redirect both output streams to a log, and verify the installed table with crontab -l. Use node-cron when scheduling belongs inside an already-running Node application, and PM2 when that application must stay alive, restart after crashes, and return after a reboot.

Choose the scheduler before writing a schedule

The right choice depends on whether the job is an independent command or part of a long-running application.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Scheduler Best fit What happens when the process is not already running? Important operational feature
System cron Independent, one-shot jobs such as backups, report generation, cleanup, or a game-server maintenance script Cron starts Node for each matching minute Runs under the crontab owner and continues scheduling without a persistent Node process
node-cron Recurring work that is part of a continuously running Node service Nothing runs if the Node service is stopped Schedule logic and application code live in the same process; supported expression features depend on the installed package version
PM2 An application that must remain alive, restart after crashes or reboots, and expose process controls PM2 supervises and restarts the application after it has been configured Startup integration, saved process lists, monitoring, environment configuration, and optional cron_restart

A useful rule is simple: use system cron for a standalone invocation, node-cron for an in-process recurring task, and PM2 for process supervision. Do not run the same schedule in more than one of these systems unless you deliberately want duplicate executions.

Prerequisites and a safe project layout

You need SSH access to the VPS, a Linux user that owns the application, Node.js installed for that user, and a script that can run without an interactive terminal. A small, predictable layout makes failures easier to diagnose:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
/srv/myapp/
  package.json
  jobs/
    backup.js
  logs/

Create the directory and make sure the scheduled user can read the script and write its log:

mkdir -p /srv/myapp/logs
chmod 750 /srv/myapp
chmod 750 /srv/myapp/jobs

Before involving cron, run the exact operation manually from the same user account. Record the absolute Node executable that succeeds:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
command -v node
node --version
cd /srv/myapp
/usr/bin/node /srv/myapp/jobs/backup.js

If command -v node returns a path under an NVM directory, use that full path in cron or provide a tightly controlled environment file. Cron does not automatically recreate the aliases, shell startup files, or NVM initialization you receive in an interactive SSH session.

Install a standalone Node.js job in a user crontab

A standard user crontab contains five time fields followed by a command: minute, hour, day of month, month, and day of week. Linux cron examines entries every minute. The command runs as the user who owns that crontab, through the configured shell.

  1. Open the correct user’s table. Log in as the application user and run crontab -e. If you must schedule for another account, switch to that account first rather than editing spool files directly.
  2. Set a minimal environment. Put SHELL and PATH assignments above the schedule. Use paths that exist on your VPS.
  3. Change to the application directory. A relative import, configuration file, or output path may otherwise resolve against an unexpected working directory.
  4. Call the absolute Node binary and script path. Do not rely on an interactive shell’s PATH or aliases.
  5. Redirect stdout and stderr. Append both streams to a dedicated log so a silent failure is still observable.
  6. Save and exit, then verify. Run crontab -l and confirm the line appears exactly as intended.

A production-style entry for a daily backup at 03:00 looks like this:

SHELL=/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
0 3 * * * cd /srv/myapp && /usr/bin/node /srv/myapp/jobs/backup.js >> /srv/myapp/logs/backup.log 2>&1

The expression 0 3 * * * means 03:00 every day in the crontab’s local timezone. The && prevents Node from starting if changing to the project directory fails. The append redirection preserves earlier log entries; 2>&1 sends errors to the same file as normal output.

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

For a script that needs environment variables, define only the values it requires. Keep secrets out of the crontab when possible by reading a file with restrictive permissions from the application:

SHELL=/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
APP_ENV=production
0 * * * * cd /srv/myapp && /usr/bin/node /srv/myapp/jobs/hourly.js >> /srv/myapp/logs/hourly.log 2>&1

After saving, inspect the installed table:

crontab -l

Do not edit files in cron’s spool directory directly. The crontab command validates and installs the per-user table, while direct edits can be ignored, overwritten, or assigned incorrect ownership.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Cron timing fields and practical expressions

Each field accepts an asterisk, a number, a comma-separated list, a range, or a step. The fields are positional:

Position Field Examples
1 Minute (0–59) 0, */10, 5,35
2 Hour (0–23) 3, */2, 9-17
3 Day of month (1–31) 1, 1,15, 1-5
4 Month (1–12) *, 1,4,7,10
5 Day of week (0–7) 1-5 for Monday–Friday on common Linux cron implementations; 0 and 7 represent Sunday
Requirement Expression Meaning
Every minute * * * * * Run once per minute
Every 15 minutes */15 * * * * Run at minutes 0, 15, 30, and 45 of each hour
At the top of every hour 0 * * * * Run at minute 0 of every hour
Every two hours 0 */2 * * * Run at 00:00, 02:00, 04:00, and so on
Every day at 03:00 0 3 * * * Run daily at 03:00 local cron time
Weekdays at 09:30 30 9 * * 1-5 Run Monday through Friday
First day of each month at 00:10 10 0 1 * * Run on day 1 of every month

When both day-of-month and day-of-week are restricted, cron commonly runs the command when either field matches. For example, 0 9 1 * 1 can run at 09:00 on the first day of the month and on Mondays, not only when the first is a Monday. Confirm the behavior of the cron implementation on your distribution before using a combined restriction for a critical task.

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

Make the command behave the same way outside SSH

“It works when I run it over SSH” usually means the interactive shell supplied something cron does not: a different PATH, a working directory, exported variables, a shell function, a loaded NVM version, or a writable terminal-dependent location.

Use absolute paths

Resolve every important executable and file path. A cron command should not depend on node being discoverable, on npm aliases, or on a relative ./config.json. If your successful binary is not /usr/bin/node, substitute the path printed by command -v node.

Handle NVM-managed Node installations

NVM is initialized by shell startup code that cron normally does not read. The safest option is to reference the selected version’s real node binary directly. If you source an environment file, keep it deterministic, avoid interactive prompts, and test it with a non-interactive shell. A Node upgrade can change the path, so recheck the crontab after changing versions.

Set the working directory explicitly

Use cd /srv/myapp && before the command, or set the working directory through a wrapper script. This matters for relative module imports, dotenv files, generated assets, and logs.

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

Provide required variables without exposing secrets

Cron has a sparse environment. Define non-secret settings in the crontab or wrapper, and have the script read a root- or user-readable configuration file with restrictive permissions for credentials. Never assume variables exported in .bashrc are present.

Test a cron-like shell

Run a command with a minimal environment and a non-interactive shell, then compare its output with the SSH run:

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
env -i HOME="$HOME" SHELL=/bin/sh PATH=/usr/local/bin:/usr/bin:/bin 
  /bin/sh -c 'cd /srv/myapp && /usr/bin/node /srv/myapp/jobs/backup.js'

This exposes missing variables and path assumptions before the schedule hides the failure in a log.

Logging, exit status, and notifications

Always capture both output streams for a job that matters. Inspect the log after the first scheduled run and make the script return a nonzero exit status when the operation fails. A process that prints an error but exits with status 0 is difficult to monitor correctly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
0 * * * * cd /srv/myapp && /usr/bin/node /srv/myapp/jobs/hourly.js >> /srv/myapp/logs/hourly.log 2>&1

Rotate logs so a frequently scheduled job cannot fill the VPS disk. If your cron daemon is configured for mail delivery, cron can mail job output to the owner or to a MAILTO address. The daemon may also send execution messages to the system log through syslog, depending on the Linux distribution and its configuration. Check both the application log and the system’s cron log when a command appears not to run.

Keep the first diagnostic run deliberately visible. Temporarily use a short interval, such as every five minutes, confirm the timestamp and exit behavior, and then replace it with the final expression. Remove the temporary line after verification.

Prevent duplicate or overlapping executions

Cron starts a new process whenever a matching minute arrives; it does not wait for the previous invocation to finish. A job scheduled every minute that takes three minutes can therefore have three concurrent copies. Duplicate execution is especially risky for billing, database migrations, item distribution, backups, and game-server maintenance.

  • Make the operation idempotent. Repeating the same invocation should produce the same final state rather than duplicate records or side effects.
  • Add an application lock. Acquire a database, Redis, or filesystem lock before doing work and release it in a finally path. Include an expiry strategy for a process that dies while holding the lock.
  • Use a lockfile strategy carefully. A stale lock must not block every future run; store the owner and acquisition time so an administrator can diagnose it.
  • Choose a scheduler with overlap controls. If your application framework or deployment tooling provides a reliable non-overlap mechanism, configure and test it rather than assuming cron provides one.

Design for a retry: network calls can fail after a remote service has already accepted a request. Use request identifiers or transaction keys so a retry does not create a second result.

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

Timezone and daylight-saving behavior

Decide which timezone the schedule represents and document it. The expression 0 3 * * * means 03:00 in the cron daemon’s local timezone unless you configure a different arrangement; it does not inherently mean UTC.

Daylight-saving transitions create two exceptional cases: a local wall-clock time can be skipped when clocks move forward, or it can occur twice when clocks move backward. A job tied to a nonexistent time may not run, while a repeated time may run twice. For sensitive tasks, use a stable timezone policy, make the operation idempotent, and record the actual run timestamp and timezone in logs. If the business rule is “every elapsed hour” rather than “at a wall-clock hour,” express that requirement in application logic instead of relying on a local-time cron entry.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Keep scheduling inside a long-running Node application with node-cron

node-cron is appropriate when the timer is part of a service that is already expected to run continuously. The application must remain alive; stopping or restarting the process stops the schedule until the service starts again.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const cron = require('node-cron');

cron.schedule('0 * * * *', async () => {
  try {
    await runHourlyTask();
    console.log(new Date().toISOString(), 'hourly task completed');
  } catch (error) {
    console.error(new Date().toISOString(), 'hourly task failed', error);
    process.exitCode = 1;
  }
});

Use the cron expression syntax supported by the version installed in your project. Some releases support an optional seconds field, while a traditional five-field expression uses minute precision. Treat seconds-field support as a library feature, not as a guarantee of system cron compatibility.

Design an in-process schedule safely

  • Start the schedule once during application startup, not once per request or per connected client.
  • Guard against overlap if the callback can run longer than its interval.
  • Handle rejected promises and log failures; an unhandled rejection can destabilize the service.
  • Use a single scheduler instance when the application is deployed in multiple processes.
  • Record the intended timezone and the actual execution timestamp.

If the service runs several replicas, every replica can execute the same callback. Use one dedicated scheduler process, a distributed lock, or a leader-election mechanism when the task must run once globally.

Use PM2 for a persistent Node process

PM2 is suited to an application that must stay online, restart after crashes, and return after a VPS reboot. It can also restart an already-running process on a cron pattern through cron_restart, but that option is a process restart policy, not a replacement for an independent one-shot command.

  1. Start the application under PM2 with its real entry point.
  2. Run PM2’s documented startup setup so the operating system launches the process manager at boot.
  3. Save the current process list so the same applications are restored after reboot.
  4. Define environment variables and the working directory in an ecosystem configuration where appropriate.
  5. After changing an NVM-managed Node version, refresh the startup command so boot uses the new binary path.
pm2 start /srv/myapp/server.js --name myapp
pm2 save
pm2 startup

The startup command prints a platform-specific command that must be run with the privileges it requests. Follow that generated command, then reboot during a maintenance window and verify the process list. Check PM2 logs and status after a crash or deployment.

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

PM2 and scheduled work in multiple workers

If PM2 runs an application in cluster mode, each worker can load the same in-process schedule. A task may therefore run once per worker. Keep singleton schedules in one process, gate the callback by instance identity, or protect the operation with a distributed lock. Verify the behavior against the PM2 version and deployment mode you actually use; do not infer singleton behavior from a single-process test.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reboot persistence: what survives and what does not

System cron does not require your Node process to be running before the scheduled minute. Once the crontab is installed and the cron daemon is enabled, it will launch the command after a reboot. This makes it a natural fit for independent jobs.

node-cron schedules exist only in the process that created them. They resume only after that application has been started again. Use PM2 startup integration, a system service, or another boot mechanism for the application itself, and then verify that the schedule is registered exactly once.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

For PM2, startup configuration and the saved process list are separate steps. Complete both, and refresh the generated startup command after a Node installation changes. A process that works until reboot but disappears afterward usually lacks one of these boot-time steps.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Troubleshooting: symptom to check

The job runs in SSH but not in cron

  • Compare the absolute Node path from command -v node.
  • Check the crontab owner and file permissions.
  • Set PATH, SHELL, and the working directory explicitly.
  • Verify every required environment variable.
  • Run the command through a minimal, non-interactive shell.
  • Inspect the redirected log and the system cron log.

There is no output

Add explicit redirection for both stdout and stderr, confirm the log directory is writable by the crontab owner, and check whether the script exits before its first log statement. Configure MAILTO only if local mail delivery is actually available.

The task runs twice around a clock change

Review the daemon’s timezone and daylight-saving behavior. Make the operation idempotent, record a unique run identifier, and use a lock if duplicate execution is harmful.

The task runs once for every PM2 worker

Move the schedule into a single-purpose process or add a distributed lock and an explicit instance gate. A cluster-wide application does not automatically imply a cluster-wide singleton timer.

The task stops after reboot

For a standalone job, confirm the crontab still belongs to the intended user and that the cron daemon is enabled. For PM2, complete startup integration, save the process list, and test restoration after reboot. For node-cron, confirm that the host process itself is restarted and that startup registers the schedule once.

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

The command starts but cannot find files

Replace relative paths with absolute paths or add cd /srv/myapp &&. Check case-sensitive filenames, permissions, and configuration-file locations.

A long job overlaps its next run

Measure the real runtime from logs, then add an application or distributed lock, widen the interval, or move the work to a queue that can enforce one-at-a-time processing.

Security and maintenance checklist

  • Run the crontab under the least-privileged account that can complete the task; avoid root unless it is genuinely required.
  • Keep scripts and directories non-writable by unrelated users, especially when cron executes them automatically.
  • Use absolute executable paths so a malicious or accidental PATH entry cannot replace a command.
  • Do not place long-lived secrets directly in world-readable files or expose them in diagnostic output.
  • Rotate logs and alert on repeated nonzero exits.
  • Document the timezone, intended owner, schedule expression, expected duration, and recovery procedure.
  • After deployments, run the command manually as the cron user and inspect crontab -l.
  • After Node or PM2 upgrades, retest binary paths and reboot recovery.

Complete examples for common VPS tasks

Every minute with a wrapper script

SHELL=/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
* * * * * /srv/myapp/jobs/run-minute.sh >> /srv/myapp/logs/minute.log 2>&1

The wrapper should set its own working directory, validate required variables, and use the absolute Node path. Keeping those details in a version-controlled script can make a complicated command easier to review.

Nightly database export

SHELL=/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
15 2 * * * cd /srv/myapp && /usr/bin/node /srv/myapp/jobs/export.js >> /srv/myapp/logs/export.log 2>&1

Because an export can take longer than its interval, add a lock and verify that the destination has enough disk space before starting.

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

Weekday game-server maintenance

SHELL=/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
30 5 * * 1-5 cd /srv/myapp && /usr/bin/node /srv/myapp/jobs/maintenance.js >> /srv/myapp/logs/maintenance.log 2>&1

Use the VPS’s documented local timezone, announce maintenance in advance, and make the script safe to retry if the server API times out.

Final pre-production check

  1. Choose one scheduler and remove duplicate schedules elsewhere.
  2. Run the script manually as the intended user.
  3. Confirm the absolute Node and script paths.
  4. Set SHELL, PATH, working directory, and required environment values.
  5. Choose and document the timezone.
  6. Add stdout and stderr logging, then confirm the log is writable.
  7. Make the operation idempotent or add overlap protection.
  8. Install with crontab -e and verify with crontab -l.
  9. Observe a real run, check its exit status, and inspect system cron logs when necessary.
  10. Test reboot recovery for PM2 or any persistent application process.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.