Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old September 18th, 2001, 11:56 AM
chakotha chakotha is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Ireland
Posts: 90 chakotha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
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...

Reply With Quote
  #2  
Old September 18th, 2001, 12:25 PM
donarb donarb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 1999
Location: Seattle
Posts: 133 donarb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
You mentioned that you set the folder to 755, did you set the script itself to 755?

Don

Reply With Quote
  #3  
Old September 19th, 2001, 07:12 AM
chakotha chakotha is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Ireland
Posts: 90 chakotha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
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

Reply With Quote
  #4  
Old September 19th, 2001, 08:53 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> 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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > first shell script not working


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway