[Dorset] Automate script

2010-09-09 Thread Tim

I have a script that lives in a folder called /backup I start from the cli by 
changing to the backup folder and then typing 

./day4

I want to automate this but the schedule program does allow me to quote a start 
up folder so when I type

 /backup/day4
or
/backup/./day4

It fails to run, 

What do I need to do to make it run from the schedule program??

Tim

--
Next meeting:  Bournemouth? TBD, Wednesday 2010-10-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
How to Report Bugs Effectively:  http://bit.ly/4sACa


Re: [Dorset] Automate script

2010-09-09 Thread John Cooper

On 09/09/10 18:34, Tim wrote:


I have a script that lives in a folder called /backup I start from the cli by
changing to the backup folder and then typing

./day4

I want to automate this but the schedule program does allow me to quote a start
up folder so when I type

  /backup/day4
or
/backup/./day4

It fails to run,

What do I need to do to make it run from the schedule program??



Have you tried

cd day4; ./day4

--
--
Discover Linux - Open Source Solutions to Business and Schools
http://discoverlinux.co.uk
--

--
Next meeting:  Bournemouth? TBD, Wednesday 2010-10-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
How to Report Bugs Effectively:  http://bit.ly/4sACa


Re: [Dorset] Automate script

2010-09-09 Thread Andrew Montgomery-Hurrell
On 9 September 2010 18:34, Tim xendis...@gmx.com wrote:


 I have a script that lives in a folder called /backup I start from the cli
 by
 changing to the backup folder and then typing

 ./day4

 I want to automate this but the schedule program does allow me to quote a
 start
 up folder so when I type

  /backup/day4
 or
 /backup/./day4

 It fails to run,

 What do I need to do to make it run from the schedule program??

 Tim

 --
 Next meeting:  Bournemouth? TBD, Wednesday 2010-10-06 20:00
 Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
 How to Report Bugs Effectively:  http://bit.ly/4sACa



If you're scheduling from cron, you should just be able to run the script
like: cd /backup  ./day4

Ideally though, if your script needs the current directory to be the same
directory that's contains the script, it might be worth putting a command to
switch to the scripts directory in the script itself.

Assuming it's a bash script:

cd `dirname $0`

should switch to the directory when inserted at the top of the script, in
which case you can just call the script file by it's full path.

-- 
Andrew Montgomery-Hurrell
Professional Geek
Blog: http://darkliquid.co.uk
Twitter: http://twitter.com/darkliquid
Fiction: http://www.protagonize.com/author/darkliquid
--
Next meeting:  Bournemouth? TBD, Wednesday 2010-10-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
How to Report Bugs Effectively:  http://bit.ly/4sACa