I have a bash file to copy files to google drive using rclone in /bin/bash :
/home/ftpbackup/web/dbbackup/database_gdrive/rclone_db.sh>/dev/null 2> & 1
I execute with the terminal running well. When executed with vestacp cronjob does not run.
The following is the contents of the bash file for rclone:
/usr/bin/ rclone copy backupdb.sql.gz remotegdrive:/backup_database/
Please help what is a mistake so that cronjob does not work. Please help immediately.
code of cronjob :
/bin/bash /home/ftpbackup/web/dbbackup/database_gdrive/rclone_db.sh>/dev/null 2> & 1
code of bash:
/usr/bin/ rclone copy backupdb.sql.gz remotegdrive:/backup_database/
Related
There is a shell script in the location /file/location/azcopy/, and an Azcopy binary is also located there
The below command runs successfully when I run it manually
./azcopy cp "/abc/def/Goa.csv" "https://.blob.core.windows.net/abc\home\xyz?"
However, when I scheduled it in crontab, the "./azcopy" command didn't execute.
below is the script
#!/bin/bash
./azcopy cp "/abc/def/Goa.csv" "https://<Blobaccount>.blob.core.windows.net/abc\home\xyz?<SAS- Token>"
below is the crontab entry
00 17 * * * root /file/location/azcopy/script.sh
Is there something I'm doing wrong?
Could someone please help me figure out what's wrong.
When you use root to execute the /file/location/azcopy/script.sh,you work directory is /root ,so you need to add cd /file/location/azcopy/ in your script.sh script to change work directory. You can add pwd in your script to see the current work directory.
So I made an script named rsync-job that runs when manually executed. When I copy it to the /etc/cron.hourly directory, it will not run. I checked crontab -e and deleted any jobs in there.
Here is the script
#!/bin/bash
rsync -e 'ssh -p 22' -azvp /home/username/Documents/ 192.168.1.160:/tmp/backups
Not sure what I am missing, greatly appreciate it!
It was a permission issue!! i created under username jay and I'm assuming cron.hourly runs as root!
i've created a bash script batch-create-users.sh and I want execute it from the terminal, Im on the folder when the script is and I run the command
./batch-create-users.sh and I got error
the file './batch-create-users.sh' is not executable by this user
I entered as sudo -s and give the password but it doesn't help, any idea?
Give execute privilege to the file before executing.
chmod +x batch-create-users.sh
So I'm trying to run a wget command using crontab every 5 minutes. My problem that I have is it's just not running. I did crontab -l to see what was running, the command is there.
the command is: wget --output-document="/Users/proudowner/Desktop/tfgo/bp.json" http://backpack.tf/api/IGetMarketPrices/v1/?key=<key>
And the error log says: /bin/sh: wget: command not found
The command also runs fine without crontab.
In crontab -e, make this your first line:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Then wget should work without specifying the full path.
You can also just specify the full path to wget (which wget to find it):
/usr/bin/wget --output-document="/Users/proudowner/Desktop/tfgo/bp.json" http://backpack.tf/api/IGetMarketPrices/v1/?key=55085a94ba8d88d1538b4576
I am using incron to monitor one of my file in /var/www/html directory.
output of incrontab -l
/var/www/html/test IN_ACCESS /home/intel/test.sh
This job is supposed to create a file in home directory, But when this job got executed (I opened the web address in browser), no file is created, following line is whon shown in /var/log/cron file
Jan 20 10:27:57 localhost incrond[26442]: (root) CMD (/home/intel/test.sh)
This clearly shows that event had occurred.
P.S: If I just run a /home/intel/test.sh in CLI its works fine and creates test file, following is my test.sh file.
#!/bin/bash
touch fm00
Mostly this problem occurs due to script file permission and ownership of script files. The same problem was faced by me. I found that my scrip owner was not a super user e.g. root.
So, you have to set the permission and ownership of your scrip as super user. Find below.
First of all edit your crontab as super user.(in RHEL like below)
[abc#host] crontab -e
and save crontab :wq!
Now set permission for script
[abc#host] chmod +x script.sh
[abc#host] chown root:root script.sh
Now restart your crontab.(in RHEL like below)
[abc#host] /etc/init.d/crond restart