ubuntu 18.04 is not accepting cron job - cron

I am trying to set a cron job in ubuntu18.04 but it is giving me error of command not found
root#UB-Machine:~# * * * * * env > /tmp/env.output
Machine: command not found
I have tried restarting cron but still i am getting same error

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.

How to pass lighthouse location : cronexpression + AWS + Python + lighthouse

I have created AWS ec2 instance and a python script to automate lighthouse reports
I have successfully ran the lighthouse python code in AWS server manually by running below lines
ubuntu#ip:~/Python_lighthouse$ python3 SEO_PYTHON_LIGHTHOUSE_lighthouse.py
However, I am struggling to run the same code via cronjob.
*/10 * * * * /usr/bin/python3 /home/ubuntu/Python_lighthouse/SEO_PYTHON_LIGHTHOUSE_lighthouse.py /home/ubuntu/Python_lighthouse/lighthouse.log 2>&1
(above cronjob working fine but getting error: /bin/sh/: lighthouse not found)
Following version and locations:
which npm
/home/ubuntu/.nvm/versions/node/v17.5.0/bin/npm
which node
/home/ubuntu/.nvm/versions/node/v17.5.0/bin/node
which lighthouse
/home/ubuntu/.nvm/versions/node/v17.5.0/bin/lighthouse
I have tried passing lighthouse to my cronjob like this but didn't work for me
*/10 * * * * /home/ubuntu/.nvm/versions/node/v17.5.0/bin/lighthouse && /usr/bin/python3 /home/ubuntu/Python_lighthouse/SEO_PYTHON_LIGHTHOUSE_lighthouse.py /home/ubuntu/Python_lighthouse/lighthouse.log 2>&1
please correct me if I am doing something wrong. Thanks in advance!!!!

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.

Setting up a crontab on debian/LINUX server

I am trying to set up a crontab for a drupal 7 site. I installed elysia cron to schedule it and if I force it to run it runs fine. However I am having difficulty setting it up to call the cron.php file .
This is what I have on my crontab -e
*/5 * * * * /usr/bin/php "/var/www/test.ccc.com/cron.php"
And this is the error that I have been getting on my var/mail
PHP Warning: include_once(/home/neela/includes/bootstrap.inc): failed to open stream: No such file or directory in /var/www/test.ccc.com/cron.php on line 13
PHP Warning: include_once(): Failed opening '/home/neela/includes/bootstrap.inc' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/test.ccc.com/cron.php on line 13
PHP Fatal error: Call to undefined function drupal_bootstrap() in /var/www/test.ccc.com/cron.php on line 14
Also my test.ccc.com server is not live yet.
Any ideas?

Cronjob doesn't execute (Cygwin)

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.

Resources