Everywhere on the internet, in articles or tutorials (in the searching of "schedule an anacron command"), I find a format such as the following:

@daily    15    rsync.daily   /bin/bash /home/steven/script/backuprsync.sh

Then I'm wondering if it is possible to schedule a single (line) command (instead of sourcing an entire file) and which would be the correct syntax form.

/bin/bash /home/steven/script/backuprsync.sh

This is a single command. It runs a script.

You can enter any single command in the anacrontab command field.

For example:

@weekly    0    my-weekly-rm    rm /tmp/delete-me

It is however much more common to schedule scripts as they would allow for doing more complicated things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.