Buy

Remote › Cron jobs

Premium

The Remote cron jobs page runs commands and scripts on your servers on a schedule. You decide whether WebDonkey starts a job over SSH or the server starts it itself from its crontab. The crontab is the list of scheduled commands that the cron service on the server works through. WebDonkey only touches the lines in it that it wrote itself. Remote cron jobs are a Premium feature.

What you do here

  • Create a cron job: server, command or script file, schedule.
  • Who runs the job: WebDonkey over SSH or the server's crontab, and how to switch between them.
  • Manage jobs: run now, pause, read the log, see the other lines of the crontab.

Page layout

  • Header: title and short description, on the right New remote cron job. Without an SSH connection the button is locked; add one under Connections first.
  • Risk notice: the strip Caution: working directly on the server, as on every Remote page.
  • Connections (left): your servers with search and folders, each with its number of jobs. Pick a server and the page shows only its jobs, and a new job starts with that server.
  • One section per server: name and user@host, below them the cards of its jobs and at the end Other lines in this crontab (not from WebDonkey, read-only).
  • A job's card: name, schedule (such as "every 5 minutes"), who starts it (started by WebDonkey or runs on the server), marks such as paused, in crontab and exit 0, then the command, Last run and, for WebDonkey jobs, Next run. On the right Run now, the pause switch, edit (pencil) and delete (bin). At the bottom, Log unfolds the latest output.

When you open the page, WebDonkey looks into the crontab of the server picked and of every server with jobs. WebDonkey lines that are already there, from another Mac for example, show up by themselves as jobs the server runs.

Without any job the page says No remote cron jobs yet. with a button to create one.

Free and Premium

Creating, editing, running and resuming need Premium. When Premium ends, your jobs stay visible, because jobs in the crontab keep running on the server. The page then shows a plain list with a note that Premium has ended. Each job has Pause (takes its line off the server) and Delete (removes the job completely). Jobs WebDonkey starts are on hold without Premium. Without any jobs a lock lies over the page. Prices are at webdonkey.io/pricing.

From the command line

wd remote cron lists the jobs, wd remote cron run runs one now. With add, edit and delete you create, change and delete. More under Servers (Remote).

Create a cron job Premium

A remote cron job runs a command or a script file on a server on a schedule, such as a shop's task runner every five minutes. Each run writes its output and exit code into a log on the server that you read in WebDonkey.

Where to find it

Sidebar Remote › Cron jobs, then New remote cron job at the top right. You open an existing job with the pencil on its card; the dialog is then called Edit remote cron job.

How to do it

  1. Pick the server on the left and click New remote cron job.
  2. Check the Server and enter a Name, such as "Clear shop cache".
  3. Under What runs, choose Command and type the line, or Script file and pick the file with Browse….
  4. Under How it runs, choose who starts the job. Triggered by WebDonkey is a good start, see Who runs the job.
  5. Choose the Schedule, such as Every 5 minutes. The expression it becomes is shown below.
  6. Leave Active ticked.
  7. Click Save. For a job on the server the button shows Writing crontab… until the line is in.
  8. Test the job with Run now on its card and look at the Log.

Save unlocks once there are a server, a name, a command or a script file and a valid schedule.

Fields and options

Field Meaning
Server The SSH connection. The server picked on the left is preselected. When editing, it can no longer be changed.
Name What the job is called in WebDonkey. For a job in the crontab it also stands after the marker there, so another Mac recognises the job by that name.
What runs › Command A single line that sh runs in your home directory on the server. Output and exit code go to the log. Chain several commands as in the shell, with && for example.
What runs › Script file A file on the server. Browse… opens Choose the script. The file runs with the interpreter of its #! line. Without one, .php runs with php, .sh with sh and .py with python3. WebDonkey looks up the interpreter's full path on the server when you save.
How it runs Triggered by WebDonkey (default for new jobs) or Run on the server.
Schedule Every minute, Every 5 minutes, Every 15 minutes, Hourly, Daily (with a time), Weekly (with weekday and time) or Cron expression with your own expression. The default is daily at 03:00.
Active Only an active job runs. In server mode the field reads Active (line is in the crontab).

Below the schedule it says which local time applies and the expression it becomes, such as "Times are this Mac’s local time. Expression: */5 * * * *". In server mode it is the server's local time.

Your own cron expression

A cron expression has five fields: minute, hour, day of month, month, weekday. */10 * * * * means every ten minutes. WebDonkey checks the expression right away:

  • For jobs WebDonkey starts, it has to be something WebDonkey can evaluate.
  • For jobs in the crontab, the rules of cron on the server apply. cron does not know L (last day of the month) or ?. A step without a range, like 5/10, is read differently by cron or not at all. The dialog then offers the equivalent with the range spelled out: Use … puts it in.

Edit and delete

  • The pencil opens Edit remote cron job. If you change How it runs there, a yellow note says what happens to the crontab line when you save.
  • The bin asks Delete remote cron job?. For a job in the crontab, WebDonkey removes its line from the crontab on the server and deletes its log there. Other crontab lines stay untouched. For a job WebDonkey starts, WebDonkey no longer starts it, and its log on the server is deleted.

What happens in the background

  • Each run appends a header line with the date, the output and the exit code to the log ~/.webdonkey/cron/<id>.log on the server.
  • For a job in the crontab, WebDonkey writes a line that ends with the marker # webdonkey: and the name. Before every change WebDonkey keeps a copy of the crontab under ~/.webdonkey/cron/backup/ (the newest 30 stay). All other lines stay exactly as they were, byte for byte, including lines not written in UTF-8. If the crontab cannot be read, WebDonkey does not change it at all.

Troubleshooting

What you see Why What to do
New remote cron job is locked There is no SSH connection. Add one under Connections.
The command must be a single line. The command contains a line break. Write it on one line, or create a script.
The script file does not exist on the server. Wrong path. Pick the file with Browse….
No interpreter for this file found on the server Neither a #! line nor a matching program. Add a #! line to the script or install the program.
Run on the server is locked, Not possible here: … The server has no crontab command. Use Triggered by WebDonkey.
The crontab on the server could not be read … Read error on the server. The crontab stayed unchanged. Save again later and check crontab -l on the server.
The crontab on the server is being changed by another operation right now … A second save is running. Try again in a moment.

See also

Who runs the job Premium

Under How it runs you choose who starts a remote cron job when it is due: WebDonkey on your Mac over SSH, or the cron service on the server. Both write the same log on the server; the differences are what the server needs and when the job runs.

Where to find it

In the dialog New remote cron job or Edit remote cron job, the section How it runs. The job's card then says started by WebDonkey or runs on the server.

The two ways

Triggered by WebDonkey Run on the server
Who starts it WebDonkey over SSH when it is due cron on the server from its crontab
What the server needs Nothing but SSH the crontab command
When it runs While your Mac is on and WebDonkey runs, or with scheduling without the app also while the app is closed Always, also while your Mac is off
Time zone Your Mac's local time The server's local time
Missed runs caught up once by the rules of cron on the server
On the card started by WebDonkey and Next run runs on the server and in crontab

Triggered by WebDonkey is the default for new jobs. For such a job to run while the app is closed, set up Run on schedule without the app under Settings › System, see Run without the app open.

If the server has no crontab command, Run on the server is locked and says Not possible here: … below it. While WebDonkey is still checking, it says Checking the server….

How to switch

  1. Open the job with the pencil.
  2. Choose the other way under How it runs. A yellow note says what happens when you save.
  3. Click Save.
  • To server mode: saving adds the line to the server's crontab, and WebDonkey no longer starts the job.
  • To WebDonkey mode: saving removes the line from the server's crontab; from then on WebDonkey starts the job.

WebDonkey makes sure the job is neither planned twice nor not at all while it switches.

When server and app disagree

Every card compares what WebDonkey expects with the crontab on the server. If they do not match, a yellow box appears on the card:

What you see Why What to do
The line is missing from the crontab on the server … The job should run on the server, but its line is gone, removed by hand for example. It does not run. Apply on the server writes the line again.
The job is paused here, but its line is still in the crontab on the server. The job is paused, but it keeps running on the server. Apply on the server removes the line.
Its line is also in the crontab on the server … WebDonkey starts the job, and the server runs it as well. It runs twice. Remove the line takes the line out of the crontab.

Jobs from another Mac

If WebDonkey finds a WebDonkey line it does not know in a server's crontab, from another Mac for example, it takes it over as a job that runs on the server. For that it looks into the crontab of the server picked and of all servers with jobs when you open the page.

See also

Manage jobs Premium

On a remote cron job's card you start it right away, pause it, read its log and see what else is in the server's crontab. The card also shows how the last run ended.

Where to find it

Sidebar Remote › Cron jobs, the job's card in the section of its server.

How to do it

  1. Click Run now. The button shows Running… until the job is done.
  2. Then the Log unfolds and shows the latest output. The mark exit 0 means success. Any other exit code shows in red.
  3. To pause, click the switch next to Run now. The card then carries paused.

What the card shows

Part Meaning
Icon Terminal for a command, file for a script file.
Schedule Such as every minute, every 5 minutes, every hour, daily at 03:00, every Monday at 03:00, or the expression itself.
started by WebDonkey / runs on the server Who starts the job, see Who runs the job.
paused The job is not active.
in crontab The line is in the server's crontab.
exit … The exit code of the last run.
Command line The command, or interpreter and script file.
Last run: … When it last ran. If it never ran, it says Not run yet. While WebDonkey looks, it says Checking the server….
Next run: … Only for active jobs WebDonkey starts.

Buttons

Button What it does
Run now Runs the job right away, with the same command and into the same log as a scheduled run. WebDonkey waits up to ten minutes for it to end. If the job takes longer, it goes on running on the server.
Switch For a job WebDonkey starts: Pause and Resume. For a job in the crontab: Pause (removes the line) and Resume (adds the line).
Pencil Opens Edit remote cron job, see Create a cron job.
Bin Deletes the job after asking Delete remote cron job?.

The log

Log unfolds the latest lines of the log, with its path on the server next to it (~/.webdonkey/cron/…log). Each run starts with a header with date and time; a run by hand carries the addition (manual) there. At the end of each run is its exit code. The refresh icon next to Log reads it again. If it is empty, it says No output yet.

Other lines of the crontab

Below a server's jobs, Other lines in this crontab (not from WebDonkey, read-only) unfolds all other lines of the crontab. You see what else runs on the server; you cannot change it here. If there are none, it says No other lines. WebDonkey only touches lines that end with its marker # webdonkey:.

Free and Premium

Without Premium, listing, pausing and deleting stay possible, so you can take jobs off a server where they keep running. Run now, Resume, creating and editing need Premium.

Troubleshooting

What you see Why What to do
This job is already running … The job is still running, started from this Mac. Wait until it is done.
Red mark exit 1 or higher The command ended with an error. Read the Log.
Changing the crontab on the server failed The server refused the write. Check permissions and free space on the server.
This remote cron job no longer exists. The job was deleted in the meantime, in another window for example. Reload the page.

See also

Cookie preferences

This website uses cookies to ensure the best experience possible. Your choice applies to webdonkey.io and the shop at shop.webdonkey.io. More information...

Technically required

Cookies required for this website to function:

Always on
WebDonkey
WebDonkey
Provider: BuI Hinsche GmbH, Neumarkt 7, 06712 Zeitz, Germany
Purpose: Your consent, colour scheme and language for website and shop, price switches; with wd_debug in the address, the measurement events in the developer console for troubleshooting
Cookies and storage: Cookie wd_consent on .webdonkey.io, shared with shop.webdonkey.io (12 months); cookies wd_theme and wd_lang on .webdonkey.io, shared with shop.webdonkey.io, only when you switch colour scheme or language yourself (365 days); localStorage wd:consent, wd:theme, wd:lang; sessionStorage wd:acc, wd:term, wd:debug (only with wd_debug in the address; until the tab closes)

Statistics

Shows us which pages and products people look at on webdonkey.io and in the shop, where visitors come from and how they get to a purchase (with order number, amount and products, without name or email address). Provider: Google. Transfer to the USA possible (EU-US Data Privacy Framework). Your choice applies to webdonkey.io and the shop together.

Google Tag Manager, Google Analytics 4
Google Tag Manager
Provider: Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Ireland
Purpose: Loads the services you agreed to, here and in the shop. Sets no cookies of its own.
Cookies and storage: none
Privacy policy
Google Analytics 4
Provider: Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Ireland
Purpose: Usage statistics: page views, clicks, scroll depth, sources, devices, load times; in the shop also basket, checkout, purchases, registration and sign-in
Cookies and storage: _ga, _ga_<ID> (2 years)
Privacy policy

Marketing

Measures whether our ads on Facebook, Instagram and TikTok lead to visits and downloads on webdonkey.io and to registrations and purchases in the shop, and builds audiences for ads. Providers: Meta and TikTok, with whom we are jointly responsible for this. With this consent Google may also set advertising cookies (_gcl_…). Transfer to the USA and other countries outside the EU possible. Your choice applies to webdonkey.io and the shop together.

Google Tag Manager, Meta Pixel (Facebook, Instagram), TikTok Pixel
Google Tag Manager
Provider: Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Ireland
Purpose: Loads the services you agreed to, here and in the shop. Sets no cookies of its own.
Cookies and storage: none
Privacy policy
Meta Pixel (Facebook, Instagram)
Provider: Meta Platforms Ireland Limited, Merrion Road, Dublin 4, D04 X2K5, Ireland
Purpose: Ad measurement and target groups on Facebook and Instagram, also in the shop (basket, checkout, purchases, registration)
Cookies and storage: _fbp (3 months), _fbc (3 months, only if you arrive through an ad), fr on facebook.com (3 months)
Privacy policy
TikTok Pixel
Provider: TikTok Technology Limited, 10 Earlsfort Terrace, Dublin, D02 T380, Ireland
Purpose: Ad measurement and target groups on TikTok, also in the shop (basket, checkout, purchases, registration)
Cookies and storage: _ttp, _tt_enable_cookie (13 months)
Privacy policy