Crontab doesn't work
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
I get an issue using Crontab. My script is working standalone but it is not working using Crontab.
Environment : Ubuntu
Crontab (sudo crontab -e) : 0 0 * * * /usr/local/bin/node /var/www/GestiawebParser/index.js
Edit #1 :
which node
: /usr/local/bin/node
ubuntu cron
 |Â
show 3 more comments
up vote
-1
down vote
favorite
I get an issue using Crontab. My script is working standalone but it is not working using Crontab.
Environment : Ubuntu
Crontab (sudo crontab -e) : 0 0 * * * /usr/local/bin/node /var/www/GestiawebParser/index.js
Edit #1 :
which node
: /usr/local/bin/node
ubuntu cron
What is the output ofwhich node
?
â Hunter.S.Thompson
Oct 3 '17 at 13:43
3
Add MAILTO in your cron and you should receive an email with any errors.
â Raman Sailopal
Oct 3 '17 at 13:44
1
@Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
â Archemar
Oct 3 '17 at 13:49
See edit #1 for the commandwhich node
. Ok so I need to executenode /var/www/GestiawebParser/index.js
using a shell script ?
â tonymx227
Oct 3 '17 at 13:52
Is it really on 2 separate lines?
â Jaroslav Kucera
Oct 3 '17 at 13:58
 |Â
show 3 more comments
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I get an issue using Crontab. My script is working standalone but it is not working using Crontab.
Environment : Ubuntu
Crontab (sudo crontab -e) : 0 0 * * * /usr/local/bin/node /var/www/GestiawebParser/index.js
Edit #1 :
which node
: /usr/local/bin/node
ubuntu cron
I get an issue using Crontab. My script is working standalone but it is not working using Crontab.
Environment : Ubuntu
Crontab (sudo crontab -e) : 0 0 * * * /usr/local/bin/node /var/www/GestiawebParser/index.js
Edit #1 :
which node
: /usr/local/bin/node
ubuntu cron
ubuntu cron
edited Oct 3 '17 at 13:51
asked Oct 3 '17 at 13:39
tonymx227
1246
1246
What is the output ofwhich node
?
â Hunter.S.Thompson
Oct 3 '17 at 13:43
3
Add MAILTO in your cron and you should receive an email with any errors.
â Raman Sailopal
Oct 3 '17 at 13:44
1
@Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
â Archemar
Oct 3 '17 at 13:49
See edit #1 for the commandwhich node
. Ok so I need to executenode /var/www/GestiawebParser/index.js
using a shell script ?
â tonymx227
Oct 3 '17 at 13:52
Is it really on 2 separate lines?
â Jaroslav Kucera
Oct 3 '17 at 13:58
 |Â
show 3 more comments
What is the output ofwhich node
?
â Hunter.S.Thompson
Oct 3 '17 at 13:43
3
Add MAILTO in your cron and you should receive an email with any errors.
â Raman Sailopal
Oct 3 '17 at 13:44
1
@Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
â Archemar
Oct 3 '17 at 13:49
See edit #1 for the commandwhich node
. Ok so I need to executenode /var/www/GestiawebParser/index.js
using a shell script ?
â tonymx227
Oct 3 '17 at 13:52
Is it really on 2 separate lines?
â Jaroslav Kucera
Oct 3 '17 at 13:58
What is the output of
which node
?â Hunter.S.Thompson
Oct 3 '17 at 13:43
What is the output of
which node
?â Hunter.S.Thompson
Oct 3 '17 at 13:43
3
3
Add MAILTO in your cron and you should receive an email with any errors.
â Raman Sailopal
Oct 3 '17 at 13:44
Add MAILTO in your cron and you should receive an email with any errors.
â Raman Sailopal
Oct 3 '17 at 13:44
1
1
@Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
â Archemar
Oct 3 '17 at 13:49
@Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
â Archemar
Oct 3 '17 at 13:49
See edit #1 for the command
which node
. Ok so I need to execute node /var/www/GestiawebParser/index.js
using a shell script ?â tonymx227
Oct 3 '17 at 13:52
See edit #1 for the command
which node
. Ok so I need to execute node /var/www/GestiawebParser/index.js
using a shell script ?â tonymx227
Oct 3 '17 at 13:52
Is it really on 2 separate lines?
â Jaroslav Kucera
Oct 3 '17 at 13:58
Is it really on 2 separate lines?
â Jaroslav Kucera
Oct 3 '17 at 13:58
 |Â
show 3 more comments
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
Crontab issues can be solved by:
- test the script outside of crontab (you did this)
- add a test script to ensure it's enabled (like
* * * * * /bin/echo test > /test.txt
) - use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)
- prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with
>> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt
)
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
Crontab issues can be solved by:
- test the script outside of crontab (you did this)
- add a test script to ensure it's enabled (like
* * * * * /bin/echo test > /test.txt
) - use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)
- prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with
>> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt
)
add a comment |Â
up vote
4
down vote
accepted
Crontab issues can be solved by:
- test the script outside of crontab (you did this)
- add a test script to ensure it's enabled (like
* * * * * /bin/echo test > /test.txt
) - use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)
- prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with
>> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt
)
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
Crontab issues can be solved by:
- test the script outside of crontab (you did this)
- add a test script to ensure it's enabled (like
* * * * * /bin/echo test > /test.txt
) - use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)
- prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with
>> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt
)
Crontab issues can be solved by:
- test the script outside of crontab (you did this)
- add a test script to ensure it's enabled (like
* * * * * /bin/echo test > /test.txt
) - use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)
- prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with
>> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt
)
answered Oct 3 '17 at 14:18
user1133275
2,267412
2,267412
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f395844%2fcrontab-doesnt-work%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What is the output of
which node
?â Hunter.S.Thompson
Oct 3 '17 at 13:43
3
Add MAILTO in your cron and you should receive an email with any errors.
â Raman Sailopal
Oct 3 '17 at 13:44
1
@Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
â Archemar
Oct 3 '17 at 13:49
See edit #1 for the command
which node
. Ok so I need to executenode /var/www/GestiawebParser/index.js
using a shell script ?â tonymx227
Oct 3 '17 at 13:52
Is it really on 2 separate lines?
â Jaroslav Kucera
Oct 3 '17 at 13:58