Adding cron job for backup.sh
Adding cron job for backup.sh
Hi,
I am running Ubuntu 14.04 + VestaCP and I'm trying to create a cron job for a script located at /root/backup.sh
The error message I'm getting when the cron runs is:
Seeing this I went to sudo visudo and added the following line:
I still get the same error when the cron runs, any suggestions?
Thanks!
I am running Ubuntu 14.04 + VestaCP and I'm trying to create a cron job for a script located at /root/backup.sh
Code: Select all
sudo bash /root/backup.sh
Code: Select all
sudo: no tty present and no askpass program specified
Code: Select all
root ALL = NOPASSWD: /root/backup.sh
Thanks!
Re: Adding cron job for backup.sh
I have some ;-)
Check this:
If it's fail, then more ideas ->
viewtopic.php?f=11&t=6812&p=20344#p20352
viewtopic.php?f=16&t=7063#p24341
Check this:
Code: Select all
ls -la /root/backup.sh
chmod +x /root/backup.sh
viewtopic.php?f=11&t=6812&p=20344#p20352
viewtopic.php?f=16&t=7063#p24341
Re: Adding cron job for backup.sh
Thank you for the suggestions, unfortunately no progress.
I have set SSH Access:bash within VestaCP and I'm still getting the same error:
Code: Select all
-rwxr-xr-x 1 root root 758 Aug 17 14:28 /root/backup.sh
Code: Select all
sudo: no tty present and no askpass program specified
Re: Adding cron job for backup.sh
Check your sudo from your user (admin, right?)
viewtopic.php?f=10&t=8349&p=27113#p27113
viewtopic.php?f=10&t=8349&p=27113#p27113
Re: Adding cron job for backup.sh
I tried running these commands:skurudo wrote:Check your sudo from your user (admin, right?)
viewtopic.php?f=10&t=8349&p=27113#p27113
I still get the same error from cron. If I try to run the script as root from console, it works ok.mkdir /etc/sudoers.d
/usr/local/vesta/upd/add_sudo.sh
chmod 0440 /etc/sudoers
chown root:root /etc/sudoers
chmod 0440 /etc/sudoers.d/admin
chown root:root /etc/sudoers.d/admin
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo
Re: Adding cron job for backup.sh
Log to ssh, use user admin and try sudo your command
Re: Adding cron job for backup.sh
Code: Select all
bash: /root/backup.sh: Permission denied
I can create the file inside public_html directory but that would make it public and I don't want that.
Re: Adding cron job for backup.sh
You have permission, if you use sudo ->prxbl wrote:Also I don't have permission to create the script as user admin under /home/admin/web/domain.com/Code: Select all
bash: /root/backup.sh: Permission denied
I can create the file inside public_html directory but that would make it public and I don't want that.
Code: Select all
sudo nano /root/backup.sh
sudo chmod +x /root/backup.sh
sudo bash /root/backup.sh
Re: Adding cron job for backup.sh
Sorry but I'm not following here: If I use sudo on the admin user I have the same problem, it works from console because it asks for password and I am entering it but when cron tries to run it:
Code: Select all
sudo: no tty present and no askpass program specified
Re: Adding cron job for backup.sh
From root
and check.
Code: Select all
bash /usr/local/vesta/upd/add_sudo.sh