Minutes Hours DayOfMonth Month DayOfWeek Username Command Allowed Values Parameter I found that the cron generator at Eas圜ron is probably one of the better ones. Although I have found that none of them is really good or complete, it might get you started building lines for your crontab. Tip : There are several so called “cron generators” online available. The first 5 are parameters related to the timing, followed by the optional username and the required file or statement(s) you’d like to execute, which can be a script or a program. But in all honesty – I have never used it (directly). The optional value, the username, is placed between de “DayOfWeek” and “Command” parameters ensuring that the job is run as that user. Crontab LinesĮach line in the crontab represents such a job and the format of each line is build out of 6 or 7 parameters separated by spaces. Tip : The easiest way to find out which one works for you: simply execute the 3 statements one at a time followed by crontab -e to see which editor opens. Keep in mind that Busybox is used in an aweful lot of devices: NAS boxes (like QNAP), Routers, Modem, Mobile devices, Satellite and cable boxes, etc. Note that Bash is the most commonly used default shell on most Linux, FreeBSD and other Linux like systems like MacOS X.įor some Cron versions, with BusyBox for example, the environment variable VISUAL should be set instead. The way to do this depends on the shell you’re using … The statement “crontab -e” often defaults to the use of “ VI“, but why use “ VI” if we can define our editor of preference by setting the EDITOR environment variable? I for one prefer the use of “ nano” … However, if you’d like to use Cron under Windows, then look at free applications like CronW (might not support modern Windows versions) or P圜ron. Microsoft Windows does not use Cron, but does have a similar function onboard, the Windows Task Scheduler, which obviously isn’t compatible with cron or the use of crontab. The user specific file ( ~ /.crontab) is said to work as usual. MacOS X should be considered a Linux flavor as well – or more correct: a FreeBSD flavor – and uses Cron as well.įor the Mac however, a manually created global crontab, /etc /crontab, might be removed automatically if you don’t use sudo touch /etc /crontab before restarting. QNAP recommend this approach to add items:Įcho "1 4 * * * /share/custom/scripts/custom1.sh" > /etc /config /crontabĮcho "40 5 * * * /share/custom/scripts/custom2.sh" > /etc /config /crontabĬrontab /etc /config /crontab & /etc /init.d /crond.sh restart MacOS X On a QNAP you will find the crontab at /etc /config /crontab. Keep in mind that the better NAS devices also run a Linux variation, like QNAP or Synology NAS devices.įor these devices, cron works as well although you’d probably stick to the global crontab and you’ll need to use an SSH connection to get to the command line (typically via “ssh or through an application like PuTTY).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |