Re: Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)
From: Kevin Nathan (knathan_at_project54.com)
Date: 08/20/05
- Next message: Dan C: "Re: Why Linux is not getting poplular in Desktop in any Corporate world?"
- Previous message: PerfectReign: "Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- In reply to: PerfectReign: "Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- Next in thread: houghi: "Re: Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- Reply: houghi: "Re: Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- Reply: PerfectReign: "Re: Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 19 Aug 2005 22:29:05 -0700
On Fri, 19 Aug 2005 21:26:48 -0700
PerfectReign <theperfectreign@yahoo.com> wrote:
> Well...
>
> I created a batch file called, startup.bat.
>
Yuk! 'batch file'? '.bat'? While perfectly fine, far too many bad
memories conjured up by that name choice; use 'script' and '.sh' or no
extension . . . ;-) I was quite adept at that crippled system and, over
the course of several years, had perfected a batch file system that
enabled me to edit, compile, link and perform other programming tasks
on any of my projects in MS-DOS, NDOS and Real/32 with a minimum of
typed commands -- it spanned 30+ batch files and close to 2000 lines.
While it worked, and worked well, I can do virtually the same thing in
Linux just by using emacs or a few, small scripts . . . :-)
> -----------------------------------------------
> su --login root -c 'echo Starting apache2 ; echo Starting mysql'
>
> /etc/init.d/Apache2 start
> /etc/init.d/MySQL start
> -----------------------------------------------
>
First of all, are you *sure* that '/etc/init.d/Apache2' and
'/etc/init.d/MySQL' exist in that dir with that exact capitalization?
If so, then you need to fix the script above. I was apparently not
clear enough about the 'echo...' commands just being place holders for
demo purposes. Try this instead:
su --login root -c '/etc/init.d/Apache2 start ; /etc/init.d/MySQL start'
These commands have to all be on the same line; putting them *after*
the line containing the 'su...' effectively keeps them from working. If
you really want user feedback in the form of echo commands (and
possibly other things), then create a script containing all you want to
do and substitute it for the above line like so:
su --login root -c /home/username/bin/nameOfBigScript
assuming 'nameOfBigScript looks something like this:
#!/bin/bash
echo Starting apache2
/etc/init.d/Apache2 start
echo Starting mysql
/etc/init.d/MySQL start
and you've done a:
chmod a+x /home/username/bin/nameOfBigScript
> I got:
>
> kai@linux:~/bin> sh startup.bat
> startup.bat: line 1: -----------------------------------------------:
> command not found
I'm pretty sure I said to *not* include the dashed lines . . . :-D
-- Kevin Nathan (Arizona, USA) Linux Potpourri and a.o.l.s. FAQ -- http://www.project54.com/linux/ Open standards. Open source. Open minds. The command line is the front line. Linux 2.6.8-24.17-default 9:54pm up 10 days 2:45, 14 users, load average: 0.11, 0.23, 0.16
- Next message: Dan C: "Re: Why Linux is not getting poplular in Desktop in any Corporate world?"
- Previous message: PerfectReign: "Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- In reply to: PerfectReign: "Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- Next in thread: houghi: "Re: Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- Reply: houghi: "Re: Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- Reply: PerfectReign: "Re: Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|