Crontab Cypress script - cron

I'm trying to make crontab launch my nl.sh script:
#!/bin/bash
npx cypress run --spec "/opt/lampp/htdocs/gabriel/cypress/e2e/"
It launches cypress tests and it works fine if I launch it using ./nl.sh.
I want to launch it using cron. Here is my crontab -e:
#!/bin/bash
* 21 * * * ./nl.sh
I want it to launch my script at 9, 14 and 19. How do I do this? I tried launching it at 21 but nothing happens.

Related

Node JS run using Cron Job on AWS

I am trying to run a node script on an AWS Ubuntu server. When I log into the Ubuntu server from my terminal and run my script with the command "node dacDev.js" it works just fine. The script writes to a log file in another folder. I want to run this with a cron command on AWS, but it won't run. Here is what my cron job says.
"* * * * * /home/ubuntu/.nvm/versions/node/v13.14.0/bin/node /home/ubuntu/getmyteatime/cronjob.sh"
The file cronjob.sh contains the absolute path of the node script. It reads:
node /home/ubuntu/getmyteatime/dacDev.js
Nothing runs. What am I doing wrong?
For the node, you also need an absolute path to run any.js file. This is achievable but rather than running with node try to write a script and do the following:
echo $PATH # /path/to/env
which npm # /path/to/npm
Paste below lines when the command crontab -e is executed.
PATH=/path/to/env
* * * * * cd /path/to/app && path/to/npm run script >>/tmp/crontab.log 2>&1
>>/tmp/crontab.log 2>&1 -- means, it will log the result to this path for debugging purposes.

Crontab fails to execute a bash script

I have a crontab job that looks like below
49 14 * * * /home/ec2-user/gitlabbackupscript/backup.sh
when i execute the script in standalone it works, but this cron job is not running. This .sh script is a very simple one liner as follows
#!/usr/bin/env bash
sudo docker exec -it gitlabce_web_1 gitlab-rake gitlab:backup:create STRATEGY=copy CRON=1 > /home/ec2-user/cronjobs/cronjoblog.log
i am new to linux world, any help on this would be helpful, i am not sure what am i missing here.
I think you're not executing the script in bash.
Try this :
49 14 * * * /bin/bash /home/ec2-user/gitlabbackupscript/backup.sh

Cron job not running in CentOS

I have a script abc.sh which runs a command to generate a csv file and send an email. This script runs fine when I manually execute it.
I have added the following entry to my crontab using crontab -e command:
00 18 * * * /home/abc.sh
However, this cron job does not execute at all.
I checked
service crond status
and the CRON service is running.
Am I missing some permissions?

Cron job does not run in RHEL

I'm running RHEL and I'm trying to set up a cron job to run a shell script every 5 minutes.
Following the directions here: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html#s2-configuring-cron-jobs
I have service crond start and chkconfig crond on. Then I edited /etc/crontab and added:
*/5 * * * * my-user /path/to/shell.sh
I did a chmod +x shell.sh. And I made sure to add a new line character at the end.
I'm expecting it to run every 5 minutes but it never executes.
What am I doing wrong?
Simply try to add the cronjob entry and check the script is working fine or not by taking the viewable output in the script.
echo "test time - $(date)" > script.sh
chmod +x script.sh
crontab -e
Then enter the cronjob as below,
*/5 * * * * sh /path/to/script.sh > /path/to/log.file
Check if the log is writing correctly. If its fine, better cross check the script that you are trying to execute via cron. Otherwise it will be a cron issue.

Raspberry crontab script running

I'm trying to run a command by cron in Raspbian.
If I run ./sec_cam.sh, than my script runs, If I try to run it via crontab every 5 min, than nothing happens.
crontab -e shows me the followings:
*/5 * * * * ./sec_cam.sh
Did I configure the crontab wrong?
Thx in advance
scripts started from a cronjob are not setup with your usual environment, especially not with your current working directory (referenced by the . in ./sec_cam.sh). so to make this work you should specify a full path name like /home/user/sec_cam.sh

Resources