Do I have to write 5 cronjobs for this?
The only other thing I have in mind is */48 */4 ***
, but I don't think that works
I don't think it is possible only with crontab but you can use a script. copy and paste the following on a terminal; obviosuly you need to change the first row by replacing /home/hf/ with an existing folder,
eventually replace myloop.sh with a more meaningful name (optional) and replacing /path/to/script.sh with the script or command you need to launch
export myhome=/home/hf/ ; export loopbat=myloop.sh ; export scripttorun=/path/to/script.sh
echo "COUNTER=0" > ${myhome}${loopbat}
echo "while [ \$COUNTER -lt 5 ]; do" >> ${myhome}${loopbat}
echo " echo The counter is \$COUNTER" >> ${myhome}${loopbat}
echo " /bin/bash $scripttorun" >> ${myhome}${loopbat}
echo " let COUNTER=COUNTER+1" >> ${myhome}${loopbat}
echo " sleep 17280" >> ${myhome}${loopbat}
echo "done" >> ${myhome}${loopbat}
then call the loop script from crontab once per day
00 00 * * * /home/hf/myscript.sh
You can use like that 48 */4 * * * echo "bla bla bla" >> /homu/x/Desktop/example.txt >/dev/null 2>&1
in crontab file or use command of crontab and you can use MAN for understand crontab. If you wont do, I can help you as spesifical. For crontab this site help what you want
You were close in your attempt. Try
48 */4 * * *
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.