Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Batch files / commands

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Mad Professor
Posts: 14
Joined: 2006-07-08 18:49

Batch files / commands

#1 Post by Mad Professor »

Hi All.

Once again I am new to this.

I know is dos you can you dos commands and or batch (.bat) files, to run one command after another.

I know this can be done with linux, but what is needed to be done?

Thanks for your time.
!!! I am a newbe to linux, so be kind. !!!
!!! Using command line interface only !!!

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#2 Post by Grifter »

open a non-existant file in an editor, start the first line with

#!/bin/sh

program1
program2
program3

and then save the file, you can run it using two ways

1) type sh filename
2) make it executable (chmod 755 filename) and ./filename (alternatively, place it in a bin dir which is in your path, echo $PATH, such as /usr/local/bin or someplace, then you can simply type: filename
Eagles may soar, but weasels don't get sucked into jet engines...

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#3 Post by Grifter »

I should also mention, if you want to learn how to do shellscripting, take a look at the scripts in /etc/init.d/

that's how I learned.
Eagles may soar, but weasels don't get sucked into jet engines...

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#4 Post by Grifter »

one more note, the last line in the file must be empty, because that's how linux determines end of file
Eagles may soar, but weasels don't get sucked into jet engines...

Mad Professor
Posts: 14
Joined: 2006-07-08 18:49

#5 Post by Mad Professor »

Ok thanks for that.

Does this look about right?

file name: hd_install

Code: Select all

#!/bin/sh

useradd hlds
usermod -d /home/hlds hlds
mkdir /home/hlds
chown hlds /home/hlds
chmod hlds 777 /home/hlds
cd /home/hlds
su hlds
wget http://www.steampowered.com/download/hldsupdatetool.bin
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin
./steam -command update -game "hl2mp" -dir /home/hlds
cd /home/hlds
wget http://taligari.lincoln.ac.uk/fun/HSB4a-serverfull.zip
apt-get install unzip
unzip HSB4a-serverfull.zip

And to run just type "sh hd_install" with in the folder where the file is.

Thanks for your time.
!!! I am a newbe to linux, so be kind. !!!
!!! Using command line interface only !!!

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#6 Post by Grifter »

no you have too many redundancies, don't use useradd use adduser, the user's home will be created by this command, so no need to usermod anything

and executing that script will just make it do _everything_ from the beginning, every time you run it

just do the top half of it manually, once, and make a script that automates whatever it is you want it to do more than once
Eagles may soar, but weasels don't get sucked into jet engines...

Penguin Skinner
Posts: 709
Joined: 2005-09-15 20:37
Location: North by Northwest

#7 Post by Penguin Skinner »

You might find these tutorials useful:

http://steve-parker.org/sh/intro.shtml

Post Reply