How to schedule an R Script Cronjob in a linux server? [closed] - linux

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

Related

How to set the output of ^Z (Control-Z) to output the PID of the stopped process? [closed]

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 8 months ago.
Improve this question
I start my script bash test.sh and then press Control-Z and get this:
^Z
[1]+ Stopped bash test.sh
All fine. But I want that the output also has the PID.
I know I can do this ps $(jobs -p) afterwards to get the PID. But how it is possible that the output of Control-Z prints directly the PID?
I don't think that's possible. That said, perhaps you can take a step back and clarify why you are hoping to do that?
Because what you can do is directly refer to the particular job with %1 (or %<n> more generally, if you have multiple background jobs) for several built-in commands (fg, bg, kill, ...):
$ sleep 30
^Z
[1]+ Stopped sleep 30
$ kill %1
[1]+ Terminated: 15 sleep 30
More details in man bash or here: https://www.gnu.org/software/bash/manual/bash.html#Job-Control-Basics

Script won't execute on crontab [closed]

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

How do I run `forever` from Crontab? [closed]

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

Loging with SSH with a different user, shows no current path [closed]

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 9 years ago.
Improve this question
I am trying to get a server up and running, there is no problem when I am using my root user, however when I created a new user and I log in with him instead of getting
user#internet:/$
I am only geting $ and I can't see the folder in which I am.
The server is running ubuntu if that helps.
Your new user is probably using a different shell. You can check by typing $0 at the prompt in each.
It sounds like root is using bash and your new user is using sh, but do the above to check.
If you want to modify the login shell for your new user, use usermod with the -s flag:
usermod user -s /bin/bash
The above would set the default shell to bash.
It's because your user runs sh as default shell.
Run as root:
chsh -s /bin/bash your_user
And login again.

Turn off crontab log [closed]

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.

Resources