B
brito
Guest
Hi,
I have a simple script that changes a directories permission (from 755 to 777), writes a backup of the database, and then reverts the permission (from 777 to 755). In order to run the chmod commands, I must use sudo.
The issue is we would like to have the script as a cron job, to run automatically, but once it executes, the script prompts for the password and the job fails.
Is there any way to work around this issue?
Thank you
I have a simple script that changes a directories permission (from 755 to 777), writes a backup of the database, and then reverts the permission (from 777 to 755). In order to run the chmod commands, I must use sudo.
The issue is we would like to have the script as a cron job, to run automatically, but once it executes, the script prompts for the password and the job fails.
Is there any way to work around this issue?
HTML:
#!/bin/bash
# sample script
sudo chmod 777 /dir1/dir2/backup
sudo su - dbUserName << 'EOF'
echo "Backup Complete"
EOF
sudo chmod 755 /dir1/dir2/backup
Thank you