Cronjob doesn't execute (Cygwin) - cron

I'm using Cygwin to synchronize folders between a Windows-Machine and an Apache server. It works fine if I execute the commands, but I can't get Cronjob to work properly.
I tried to create a simple mkdir command as a cronjob and when I save the crontab, it successfully installs it.
My Cronjob is:
*/1 * * * * mkdir newfolder
I wait for the new folder to pup up, but nothing happens.
In the cron.log it says:
Cron 7072 fork: child -1 - CREATEPROCESSW failed for c:cygwin/usr/sbin/cron.exe, errno 30
Can anybody help?

I solved the problem: (drumroll)
I reconfigurated it... often!
I kept trying "cron-config" time after time and now it works. I'm still not any smarter what I configurated wrong/right.
I'm sorry for the vague help if anybody with the same problem stumbles upon this.

Related

Cron Error :(cd) ERROR (getpwnam() failed - user unknown)

I have a simple bash script and it works fine when I execute it directly (bash testfile.sh). But when I use it in crontab, it is not working..
*/10 * * * * cd /var/trafficviewer/script; ./testfile.sh
I made the chmod +x testfile.sh as well.In error log, I could found below error..
Jul 12 16:45:01 XX crond[1439]: (cd) ERROR (getpwnam() failed - user unknown)
Can someone help me on this error?
Note: I dont have root access for this server. I installed these crons by using sudo commands.

Executing a node script via crontab

can anyone help me figure out why my cron scheduling doesnt work?:
0 8 * * * /usr/bin/node /home/globein_ext/mysql-slack-bot/index.js
I'm trying to run a node app each day at 8am. I locate node first and then access the file I want run. Nothing seems to happen though.
Thanks for any and all help!

cron Job Won't Run on R Scripts on Google Compute Engine

Following these instructions I got R-Studio Server running on a Google Compute Instance: http://code.markedmondson.me/launch-rstudio-server-google-cloud-in-two-lines-r/
When I open a terminal from this RStudio-Server I note that man, ps, vi, cron are all absent.
bash: ps: command not found
My goal is to have a simple cron job periodically run an R-Script.
I manually installed cron with:
sudo apt-get update
sudo apt-get install cron
Still, I can't get cron to run this test:
cmd <- cron_rscript("/home/law9723/now_to_file.R")
cron_add(cmd, frequency = "*/1 * * * *", id = "now_to_file", description = "Write now to file every minute")
-Clearly Confused
I got things to work eventually by using these very helpful instructions: https://yuhuisdatascienceblog.blogspot.ca/2017/07/setting-up-r-studio-server-on-google.html
Using absolute path names with everything associated with cron is sage advice.
I think when I created a vm with this command the sandbox that Rstudio-server lives in is very minimal. Hence, no vi, man, cron, ps...
gce_vm(template = "rstudio",
name = "my-rstudio",
username = "mark", password = "mark1234",
predefined_type = "n1-highmem-2")
I have had success using the rstudio addin. A reference is
http://www.bnosac.be/index.php/blog/51-new-rstudio-add-in-to-schedule-r-scripts.
I am also under the impression that you have to start cron with
sudo cron start
As in https://cran.r-project.org/web/packages/cronR/README.html.
I install the packages shinyFiles, miniUI and cronR when I first get into the Rstudio on GCE after using googleComputeEngineR locally like you. Then "Schedule R scripts on Linux/Unix" will appear in the add-in list.

run command at interval on debian

So i have a debian web mapping server for my minecraft world. In order for the map to display the correct information two commands have to be run periodically. I have tried following a few guides to use crontab but so far have failed (and even had to restore the debian image -.-) I am new to linux as a whole and need a step by step guide in plain english to do the following.
run:
"overviewer.py --config /home/mc/test.cfg"
every 30 minutes on the hour and
"overviewer.py --config /home/mc/test.cfg --genpoi"
every five minutes on the hour
It seems pretty straight forward but I have literally spent the better part of two months doing this cause I keep screwing things up.
Thanks for any help!
Remember if you are using crontab, to use the full path to the python script. In debian you can type pwd in the terminal to show the path to your current location.
Assuming the python script is also located in /home/mc/ you should use the command:
/home/mc/overviewer.py --config /home/mc/test.cfg
I would suggest you look into crontab again, the ubuntu help page has alot of information. https://help.ubuntu.com/community/CronHowto
For every 30 minutes:
0,30 * * * * /home/mc/overviewer.py --config /home/mc/test.cfg
And for every 5 minutes:
*/5 * * * * /home/mc/overviewer.py --config /home/mc/test.cfg --genpoi

Trouble running cron on Joyent

I'm trying to set up a node script to run as a cron job on Joyent. I can run arbitrary commands but node scripts to seem to execute. As an example:
# cron
# call a script every minute
# being specific about the location of node and the script to run
* * * * * /home/node/local/nodejs/bin/node /full/path/to/some-script.js
// node script at /full/path/to/some-script.js
var fs = require('fs');
fs.writeFile('/home/node/node-service/some-script.log', new Date.toString(), 'utf8');
What I expect to see after one minute is a file at /home/node/node-service/some-script.log with content like Mon Jan 21 2013 15:19:11 GMT-0600 but I see nothing. This is still the case even if the script is set to full read, write and execute permissions for all users and whether the crontab is set for the root or node users.
What am I missing?
Thanks
The fourth optional argument to writeFile is a callback to fire when the file system is done writing the file. You can use it to determine the error that is happening, as it's only argument is an error. Refer to the docs here.
It appears to be working now. I'm not sure what I changed that got it working. It may have been a permissions issue.

Resources