Moxa TC-6110-T-LX [16/117] Cron for executing scheduled commands

Moxa TC-6110-T-LX [16/117] Cron for executing scheduled commands
TC-6110 Linux User's Manual Basic Platform Configuration
2-9
Check to make sure the script has been removed.
moxa@MOXA:~#ls -l /etc/rc?.d/*tcps*
ls: cannot access /etc/rc?.d/*tcps*: No such file or directory
Cron for Executing Scheduled Commands
The cron daemon reads /etc/crontab to retrieve scripts and other commands to be run at regularly
scheduled times.
Cron wakes up every minute and checks each command listed in the crontab file to see if it should be run at
that time. Whenever cron executes a command, a report is automatically mailed to the owner of the crontab
(or to the user named in the MAILTO environment variable in the crontab, if such a user exists).
Modify the file
/etc/crontab to schedule an application. Crontab entries follow the format below:
mm h dom mon dow user command
minute hour day of month month day of week user Command to be run
0-59 0-23 1-31 1-12 0-6 (0 is Sunday)
For example, to synchronize the RTC at 8 AM every day, use the following cron entry:
#minute hour dom date month dow user command
00 8 * * * * root hwclock -w
Every column in a crontab entry must be marked with a character. The asterisk indicates every possible unit,
so that setting an asterisk in the day-of-week column will configure cron to run the command on every day of
the week. If you wish to run a command every X minutes or every X hours, then use the format
*/X.
So, using the example above, the hwclock command will be run under root ownership at the 0 minute (i.e.
top of the hour) of 8 AM on every day of the month, for every date, during every month, and on every day of
the week. The following example shows another way of using cron to update the system time and RTC.
1. Write a shell script named
fixtime.sh and save it to the /home directory.
#!/bin/sh
ntpdate time.stdtime.gov.tw
hwclock –w
exit 0
2. Reset the access permissions for fixtime.sh.
moxa@MOXA:~# chmod 755 fixtime.sh
3. Modify the /etc/crontab file to run fixtime.sh every 10 minutes (i.e.: */10) by adding this line:
*/10 * * * * root /home/fixtime.sh
Mounting a USB Storage Device
Since mounting USB storage devices manually can be difficult, a Debian package named usbmount is used to
mount USB devices automatically. Usbmount relies on udev to mount USB storage devices automatically
under the device nodes
/media/usb0, /media/usb1, and so forth. Use the mount command (with no
arguments) to verify if the USB device has been successfully mounted.
moxa@MOXA:~#
mount
...
/dev/sdd1 on /media/usb0 type vfat
(rw,nodev,noexec,noatime,nodiratime,sync,fmask=0022,dmask=0022,codepage=cp437,io
charset=utf8,shortname=mixed,errors=remount-ro)

Содержание

Похожие устройства

Скачать