What does this cron format mean?
I have a cron job with the following format:
0 01,16,31,46 * * * *
What does that mean?
To my knowledge, the second value is for the hour, but there's no 31st or 46th hour in the day, so I'm a bit confused.
See also questions close to this topic
command mount into crontab doesn't work in macOS
I set a crontab for mounting a remote volume, if I run the following command it works
mount -t smbfs //<__username__>:<__password__>@<__remote_host>/<__remote_folder__> <myFolder>
but into a crontab it doesn't work
30 13 * * * /path/to/my/script
How to programmatically schedule a file deletion in Node.js or C++ on Ubuntu?
Is there a way to schedule a recently created file to be deleted on Linux using either Node.js or C++? I am running a server app that spawns a C++ executable (either could schedule the file deletion)
How to schedule crontrigger to run on certain days of the week?
I have a job to execute on Saturday and Sunday, but not on weekdays. This is how I schedule it:
myTriggerBuilder.withSchedule(cronSchedule("0 0 0 * * ?")).build();
This will run at 00:00:00 server time each day. However, I would like to make it work only on Saturday and Sunday, however, in American calendars Saturday is the end of the week and Sunday is the start of the week. I have been searching the docs for an example or description which explains how can I specify certain days of the week rather than intervals, but the docs either does not provide that information, or I have missed it. I have tried it this way:
myTriggerBuilder.withSchedule(cronSchedule("0 0 0 * * SAT,SUN")).build();
However, the whole thing crashed:
java.lang.RuntimeException: CronExpression '0 0 0 * * SAT,SUN' is invalid.
Is there a way to express what I want, that is, to tell the scheduler which days of the week I intend to run the job?
How to run a bash script from crontab and send the output to desktop notifications
I'm trying to get the RAID status every time i boot into my system (Debian) and send the output as notification in the desktop. This works as expected from terminal:
sudo mdadm --detail /dev/md0 | grep 'Working Devices :' | while read OUTPUT; do notify-send "$OUTPUT"; done
but it won't work if I run a crontab job pointing at the script :
mdadm --detail /dev/md0 | grep 'Working Devices :' | while read OUTPUT; do notify-send "$OUTPUT"; done
The script is set to be executable and is ran from crontab root as:
this also won't work:
* * * * * /PATH/scripth.sh
and logs are not produced when:
* * * * * /PATH/scripth.sh > /PATH/crontab.log
double quote inside mysql script not working
I want to create a cron script for my FreePBX. If I connect from terminal to mysql it works this way:
mysql -u user -ppasswd table UPDATE kvstore SET val='$HOST' where `key`="externip";
but inside a script like this:
mysql -u user -ppasswd table -e "UPDATE kvstore SET val='$HOST' where `key`="externip";";
it returns me:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=externip' at line 1
For instance I have this script with no problem because have no double quotes inside the script:
mysql -u user -ppasswd table -e "UPDATE sipsettings SET data = '$HOST' WHERE sipsettings.keyword = 'externip_val' AND sipsettings.seq = 40 AND sipsettings.type = 0;";
I tried all the ways I can putting \" for the quotes but no way to find the solution.
Thanks for your answer if anyone can help me!
unable to run R script in crontab in docker container
I'm trying to run a R script inside docker container. Here is the example.
My working directory is like below.
myRDocker -dockerfile -scripts -save_iris.R
In the directory
myRDocker, there is a
dockerfileand a directory
scripts, which contains a R script
My R script
save_iris.Ris like below:
My dockerfile is like below:
# Install R version 3.6 FROM r-base:3.6.0 #install crontab RUN apt-get update && apt-get -y install cron RUN mkdir /data COPY /scripts /scripts
I went to my directory
myRDockerand build docker image
docker build -t baser .
I run the docker container in bash.
docker run -it baser bash
After I get into the container, I did:
then add this line, then save
* * * * * Rscript /scripts/save_iris.R
It should save the file to the folder
/dataevery min. However, I never found any file in the data folder inside the container.
My question is:
what did I do wrong in the above procedure? I feel like I might be missing something.... but could not figure out why...
what should I do if I want to run the scheduled cron task whenever container start. (something like put the cron task in a file, and run when container start....)