#!/bin/bash
time=`date | cut -f4 -d" " | cut -f1,2 -d:`
yes=05:10
if [ "$time" = "$yes" ]
then
/sbin/reboot
else
echo " `date` - Not Re-booted" > /etc/motd
fi
Save file as rboot.sh and put it in /bin file. And now add the cronjob to execute the script.
# crontab -e
42 05 * * * sh /bin/rboot.sh
If the script is not executed it will display the message in motd
time=`date | cut -f4 -d" " | cut -f1,2 -d:`
yes=05:10
if [ "$time" = "$yes" ]
then
/sbin/reboot
else
echo " `date` - Not Re-booted" > /etc/motd
fi
Save file as rboot.sh and put it in /bin file. And now add the cronjob to execute the script.
# crontab -e
42 05 * * * sh /bin/rboot.sh
If the script is not executed it will display the message in motd
Terima kasih telah membaca artikel tentang Shell Script for rebooting system at a particular time di blog Tutorial Opensource and Linux jika anda ingin menyebar luaskan artikel ini di mohon untuk mencantumkan link sebagai Sumbernya, dan bila artikel ini bermanfaat silakan bookmark halaman ini di web browser anda, dengan cara menekan Ctrl + D pada tombol keyboard anda.