Jump to content


Photo

How to allow Normal Linux User to run particulare bash / shell script


  • Please log in to reply
No replies to this topic

#1 php-pandit

php-pandit
  • New Members
  • Pip
  • Newbie
  • 3 posts
  • LocationBhuigaon, Vasai, Mumbai, Maharashtra, India

Posted 26 August 2006 - 06:45 AM

Hi

Plz, help me out i want to allow one of my linux user to run this below bash script to take mysql database backup.

Shell Script:

<!---------------- ##################### ----------------------->

#!/bin/bash
TIMESTAMP=`date +%m-%d-%y-%H%M`

cd /home/backups/mysql

find /home/backups/mysql/*.tar.gz -mtime +7 -exec rm -f {} ;


# my database
DBNAME=my_database
mysqldump --opt -c -e -Q -u MYSQL_USER -p'MYSQL_PASSWORD' $DBNAME > $DBNAME.sql
tar czpf $DBNAME.$TIMESTAMP.tar.gz $DBNAME.sql
rm -f $DBNAME.sql

<!---------------- ##################### ----------------------->

But when i am running this script as a normal user it is giveing me an  error of "Permission denied"

Thanks
Harshad Pandit
alias(PHP Pandit)
<a href="http://php-pandit.bl...t.com/">Harshad Pandit's Blog</a>
Thanks,
Harshad Pandit
Software Devloper,
Email: php.pandit@gmail.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users