How to pass lighthouse location : cronexpression + AWS + Python + lighthouse - python-3.x

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!!!!

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!

ubuntu 18.04 is not accepting cron job

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

Redmine Cron Job Issue

I must set a Cron Job on Redmine to automatically manage IMAP fetching. I try to supply as many infos as I can about my environment:
Redmine version 3.2.0.stable
Ruby version 2.1.5-p273 (2014-11-13) [x86_64-linux-gnu]
Rails version 4.2.5
Environment production
Database adapter Mysql2
I have installed luismaia/redmine_email_fetcher as a plugin, and I have configured it for gmail IMAP. Up to this point I had no error messages and, by trying a test tool on Redmine, I get a success message.
I sum up the plugin configuration on Redmine as it follows:
Configuration type: IMAP
Is configuration active? true
Host : imap.gmail.com
Port: 993
SSL? yes
Email username: mailAddress
Password: mailAccountPwd
Folder Name: Inbox
Method for unknown users: accept
Now, I must run a Cron Job. At this link:
https://github.com/luismaia/redmine_email_fetcher
I have found the following:
*/5 * * * * www-data /usr/bin/rake -f /opt/redmine/Rakefile --silent redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production 2>&- 1>&
that I personalize as it follows:
*/5 * * * * www-data /usr/bin/rake -f /opt/redmine/Rakefile --silent redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production host=imap.gmail.com username=mailAddress password= mailAccountPwd port=993 --trace
Coming to the point: the line above doesn't work; and I've no idea why.
I can add that:
in /usr/bin I see rake2.1
opt directory (/var/opt) is empty.
I do hope I have explained my issue in a decent way.
Thank you in advance, really.
ps:
I tried also:
*/5 * * * * www-data /usr/bin/rake2.1 -f /var/www/redmine/Rakefile redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production 2>&- 1>&-
but nothing happens.
Test the which command:
which rake
for me it's in /usr/local/bin and not in /usr/bin
Next try to chdir in your redmine folder before launch the command in the crontab:
*/5 * * * * cd /var/www/redmine/ && sudo /usr/local/bin/rake redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production 2>&- 1>&-
Hope this can help you.
Cheers,
Luc

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