Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
Set this task in crontab, why didn't run every minute?
$ crontab -e
* * * * * cd /my/project/source/path && bundle exec rake publisher:publish --silent
But run this from terminal will work:
$ cd /my/project/source/path && bundle exec rake publisher:publish --silent
Try instead:
/my/project/source/path/bundle exec rake publisher:publish --silent
Or:
"* * * * * * bash -c 'cd /my/project/source/path && bundle exec rake publisher:publish --silent'"
This way you pass the command as an argument to bash...
Related
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
Improve this question
I'm running the script below on a gcp debian instance. When shutting down my computer, ssh disconnects, and the script stops. Below is my script:
wget -P/root -N --no-check-certificate "https://raw.githubusercontent.com/reeceyng/v2ray-agent/master/shell/install_en.sh" && mv /root/install_en.sh /root/install.sh && chmod 700 /root/install.sh &&/root/install.sh
I have tried Tmux and screen to prevent this based on other posts suggestions. None of them were helpful. All processes stop after some time.
Use nohup to detach your process (here, wget) from your shell. For example:
nohup wget -P/root -N --no-check-certificate "https://raw.githubusercontent.com/reeceyng/v2ray-agent/master/shell/install_en.sh" && mv /root/install_en.sh /root/install.sh && chmod 700 /root/install.sh &&/root/install.sh &
should do the trick.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have a script which executes manually:
#!/bin/bash
mount -t cifs //192.168.138.18/Shared_Drive /mnt/share -o username=user,password=guest
But sudo crontab -e doesn't execute it. I tried:
#reboot /home/user/startup.sh
#reboot sh /home/user/startup.sh
#reboot bash -l /home/user/startup.sh
#reboot /bin/bash /home/user/startup.sh
Nothing works. Permits are:
-rwxr-x--x 1 user user
crontab -e doesn't execute scheduled command, it opens your crontab rules file in an editor
The command will then be executed by cron itself on the specified schedule. (If the rule is written correctly. If you want help checking that then include the cron rule.)
Also note that the crontab command man page says
Note that su(8) can confuse crontab and that if you are running inside of su(8) you should always use the -u option for safety's sake
So you should run sudo crontab -u root -e
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I am trying to schedule node server restart on OS reboot (Ubuntu 16.04 LTS). I wrote:
crontab -u username -e
then I added following line:
#reboot /usr/local/bin/forever start -c /usr/bin/node /home/username/node/bin/www
I get the success message after saving or updating this file. There seems to be no effect on server reboot.
I'd wrap that into a bash script in the user's home directory's bin.
/home/username/bin/start_my_node_app.sh
Then in your crontab...
#reboot /home/username/bin/start_my_node_app.sh >/dev/null 2>&1
Though according to this article, #reboot may not work for non-root users.
https://unix.stackexchange.com/questions/109804/crontabs-reboot-only-works-for-root
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Improve this question
I am trying to schedule a cronjob to execute an R Script in a linux server. I have achieved to type the commands in the server manually and it works. To do so i have to type the following commands:
root#debian:~# cd /home/script2
root#debian:/home/script2# Rscript scriptSecos.R
How can i specify a cronjob that will execute the previous commands, once a day?
Thank you.
The following cron job will run Rscript scriptSecos.R from the path /home/script2, once a day, at 0:00 (midnight).
0 0 * * * cd /home/script2; Rscript scriptSecos.R >/dev/null 2>&1
If you want to save the output of the script to a file, change >/dev/null with >/path/to/file.
You can copy and paste this cronjob in your crontab file (You can open the file by using command crontab –e)
The following site provides useful reference information for crontab
http://www.adminschoice.com/crontab-quick-reference
With your example, the following will run the job at 3 am everyday.
00 03 * * * Rscript /home/script2/scriptSecos.R
add cron as below.
eg:
15 23 * * * Rscript /home/script2/scriptSecos.R >/dev/null 2>&1
you have to mention running script type.Then allow cron logs and check its running or not
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
The log file is located at /var/log/cron. Its size grows too fast and it seems to contain a lot of unimportant data that I would never want to see. So I try to find a way to turn it off but still don't know how.
Here are some more details about the crontab:
crontab -l
*/5 * * * * /usr/sbin/ntpdate 10.0.1.10
*/1 * * * * cd /tmp && netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c > net.tmp && mv -f net.tmp net.cache
*/1 * * * * /script/svrcheck/openvpn.sh > /dev/null 2>&1
tail /var/log/cron
Dec 17 09:25:01 HB04 crond[54509]: (root) CMD (/usr/sbin/ntpdate 10.0.1.10)
Dec 17 09:25:01 HB04 crond[54500]: (root) CMD (/script/svrcheck/openvpn.sh > /dev/null 2>&1)
Dec 17 09:25:01 HB04 crond[54504]: (root) CMD (cd /tmp && netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c > net.tmp && mv -f net.tmp net.cache)
Please let me know if I could provide you more info.
you can control logging using syslog.conf
comment the cron entry inside the syslog.conf as follows .
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none,cron.none -/var/log/syslog
#cron.* /var/log/cron
and restart the syslog.