|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
first shell script not working
Hi,
I am trying to run my first shell script. What I want to do is to backup a database daily using cron ( eventually ). I created the following file script.sh in /home/pathto/script.sh. I set the permissions for the folder to be chmod 755 to execute. #!/bin/sh mysqldump dbname > /home/pathto/dbnamebk.sql -p dbpasswd rebootvs To start with I merely tried to execute the script from the telnet prompt by typing /home/pathto/script.sh - and it didn't work! I got bash: /home/pathto/dbnamebk.sh: Permission denied Was it something to do with the password being prompted or something does anyone know?? I should be able to sort out the cron once I can get this working... |
|
#2
|
|||
|
|||
|
You mentioned that you set the folder to 755, did you set the script itself to 755?
Don |
|
#3
|
|||
|
|||
|
Right - I chmoded the file itself which wasn't set to execute and when I try to run the script from /root I get
No such file or directory I tried cd-ing to the directory containing the script and typing: script.sh and I got bash: script.sh: command not found I must be missing something obvious |
|
#4
|
|||
|
|||
|
>> bash: script.sh: command not found
You need to run it like so: ./script.sh. Within your script, you should use full path to mysqldump. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > first shell script not working |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|