scripts to automate tasks

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

scripts to automate tasks

Postby fibreshouse » Fri Apr 15, 2005 1:06 pm

I'm using synce to talk to my Ipaq but it requires various commands to setup properly.
I know that you can script these but am having problems understanding how to write a script that will send a comand as user then a second command as SU.
I know it'll be fairly simple but I'm haviong real brain fade.
fibreshouse
 
Posts: 2
Joined: Fri Apr 15, 2005 12:55 pm

RE: scripts to automate tasks

Postby nelz » Fri Apr 15, 2005 1:42 pm

Code: Select all
#!/bin/sh

first command
su -c "second command"


If you want to do this without it asking for the root password, you'll need to investigate sudo. man sudo gives a good explanation of how it works and the config file is well comented with examples.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8504
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby M0PHP » Fri Apr 15, 2005 7:14 pm

Make sure you make the script executable afterwards using chmod +x or by running `bash /path/to/script.sh` or something to that effect.
User avatar
M0PHP
LXF regular
 
Posts: 737
Joined: Wed Apr 06, 2005 7:40 am
Location: Bishop Auckland, County Durham, UK


Return to Help!

Who is online

Users browsing this forum: No registered users and 4 guests