如何在 Linux 服务器中安排 R 脚本 Cronjob? [英] How to schedule an R Script Cronjob in a linux server?
问题描述
我正在尝试安排一个 cronjob 在 Linux 服务器中执行 R 脚本.我已经实现了在服务器中手动键入命令并且它可以工作.为此,我必须键入以下命令:
- root@debian:~# cd/home/script2
- root@debian:/home/script2# Rscript scriptSecos.R
如何指定一个每天执行一次之前命令的 cronjob?
谢谢.
以下 cron 作业将从 /home/script2
路径运行 Rscript scriptSecos.R
,一次一天,在 0:00(午夜).
0 0 * * * cd/home/script2;Rscript scriptSecos.R >/dev/null 2>&1
如果要将脚本的输出保存到文件中,请将 >/dev/null
更改为 >/path/to/file
.>
您可以将此 cronjob 复制并粘贴到您的 crontab 文件中(您可以使用命令 crontab –e
打开该文件)
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
)
这篇关于如何在 Linux 服务器中安排 R 脚本 Cronjob?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!