Help with shell script to run the commands reading options from local file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with shell script to run the commands reading options from local file
# 1  
Old 06-29-2009
Help with shell script to run the commands reading options from local file

I have to use shell script to run series of commands on another unix box by connecting through SSH and giving user credentials. For running commands on remote machine I have to use options reading from a local file.
Process:
Connecting to remote unix server <host1.ibm.com> through ssh
Login: <username>
Password: <password>
cd /opt/ibm/websphere/appserver
chmod -R 775 bin
chmod -R 770 config
...........................
...........................
...........................
chmod -R 777 logs (changing the file permissions for the files listed in the options.txt file)

options.txt has the following lines
775:bin
770:config
...............
...............
...............
777:logs


I want a shell script to accomplish the above task. It may be really simple to write a script for this but I am very new to scripting. Thank you in advance for your replies.
# 2  
Old 06-29-2009
Will the options.txt file be on local or remote host?

BTW, why do you want to modify the default permissions on the websphere subdirectories? If you are running websphere as a non-root user, you should just 'chown -R' the /opt/ibm/websphere directory to that user and leave the default permissions alone. Also, if you're running this on a production host, I definitely would not set the logs directory to 777. This is just inviting a DoS attack or for someone to alter the logs if the system is exploited.

-B
# 3  
Old 06-29-2009
Quote:
Originally Posted by bwhitehd
Will the options.txt file be on local or remote host?

BTW, why do you want to modify the default permissions on the websphere subdirectories? If you are running websphere as a non-root user, you should just 'chown -R' the /opt/ibm/websphere directory to that user and leave the default permissions alone. Also, if you're running this on a production host, I definitely would not set the logs directory to 777. This is just inviting a DoS attack or for someone to alter the logs if the system is exploited.

-B
The options file is local, at this time changing the file permissions is just for example purpose, I want to run other commands similar to chmod by reading the options from the local file. If I can get help in this regards it will be great help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Shell Programming and Scripting

Except script to run a local shell script on remote server using root access

local script: cat > first.sh cd /tmp echo $PWD echo `whoami` cd /tmp/123 tar -cvf 789.tar 456 sleep 10 except script: cat > first #!/usr/bin/expect set ip 10.5.15.20 set user "xyz123" set password "123456" set script first.sh spawn sh -c "ssh $user@$ip bash < $script" (1 Reply)
Discussion started by: Aditya Avanth
1 Replies

3. Shell Programming and Scripting

To run a local shell script in a remote machine by passing arguments to the local shell script

I need to run a local shell script on a remote machine. I am able to achieve that by executing the command > ssh -qtt user@host < test.sh However, when I try to pass arguments to test.sh it fails. Any pointers would be appreciated. (7 Replies)
Discussion started by: Sree10
7 Replies

4. UNIX for Dummies Questions & Answers

Commands to run from shell script

Hi script> isumid 98765432 if i give above command in cmd prompt it is running the same thing if i give inside the shell script it is not working below is the code #!/bin/bash isumid 98765432 please give me a solution (16 Replies)
Discussion started by: Ramrangasamy
16 Replies

5. Shell Programming and Scripting

shell script to run commands in different terminals

hi, how to write shell script that runs different commands(like:ls,ps,ls-l) in differnt terminals(each command should run in different terminal). my main motive is to run different 'c' program exe's available in different locations in different terminals. thanks sai (2 Replies)
Discussion started by: saidopdf
2 Replies

6. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

7. Shell Programming and Scripting

shell script to run a few commands help!

Hi friends this is first post i am very new to shell scripting so i require your expertise to do the following thank u I need to write a shell script which will run the following commands pg_dump bank > backup(Enter) Wait for bash prompt to appear coz it indicates that the command is... (23 Replies)
Discussion started by: perk_bud
23 Replies

8. Shell Programming and Scripting

how can I write script that lets me run shell commands?

Hello I want to make simple extension to vi , you know how you want to run some shell command you do ":! ls -l " , then you go out the vi the command executed and then you hit enter and you back to vi but now I want to be able to go out of vi and run several command outside of vi .. and in... (3 Replies)
Discussion started by: umen
3 Replies

9. Shell Programming and Scripting

How to run unix commands in a new shell inside a shell script?

Hi , I am having one situation in which I need to run some simple unix commands after doing "chroot" command in a shell script. Which in turn creates a new shell. So scenario is that - I need to have one shell script which is ran as a part of crontab - in this shell script I need to do a... (2 Replies)
Discussion started by: hkapil
2 Replies

10. UNIX for Dummies Questions & Answers

shell script, reading and resetting local variables

Hello, I have a problem with trying to run a shell script that reads in user input, validates, and sets to a 'default' value if the input is not valid. I cannot get the portion of resetting to a default value to work. These lines are skipped, and the value of x is still whatever the user... (1 Reply)
Discussion started by: b888c
1 Replies
Login or Register to Ask a Question