Executing a command at startup


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Executing a command at startup
# 1  
Old 12-10-2008
Executing a command at startup

Hey all,

How do I execute a file at startup automatically.

From what I've read is that I need to put it into my .bashrc file. I'm not sure where to go from there. Can I just type commands into that and they'll run next time I restart my server?

Right now I have added these lines:

cd SmartFoxServer_PRO_1.6.2/Server/
./start.sh

I don't want to restart my machine until I know this is correct...

Thanks,
Nathan
# 2  
Old 12-10-2008
Your question is somewhat confusing. Are you talking about when you login or when your system is booted up? They are two entirely different scenarios.
# 3  
Old 12-10-2008
Well, I suppose it would be for login as it needs to run a shell script that starts a server program. If either would work, I would like to use the easier approach.

Thanks for the response,
Nathan
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Apache tomcat startup script not booting at startup.

I copied the script from an AskUbuntu post - #!/bin/bash ### BEGIN INIT INFO # Provides: tomcat7 # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop Tomcat server ### END INIT INFO ... (14 Replies)
Discussion started by: Hijanoqu
14 Replies

2. Shell Programming and Scripting

Error while executing sh command

Hi, I have 2 files temp1.sh and temp2.sh as follows: =========== temp1.sh =========== echo "session1" sh temp2.sh echo "exit session2 and enter session1" ================================= ============= temp2.sh ============= echo "session2" sh echo "exit session2"... (5 Replies)
Discussion started by: RP09
5 Replies

3. UNIX for Dummies Questions & Answers

executing a command using ssh

Hi All, I am trying to execute a command using ssh as below. ssh user123@servername "which ctmcontb" It is gving the error as below no ctmcontb in /usr/bin /usr/sbin /opt/sysadm/bin Not sure from where the PATH is getting picked up. But When I login direclty to the server I am... (5 Replies)
Discussion started by: anilreddy103
5 Replies

4. UNIX for Dummies Questions & Answers

Doing a capture while another command is executing?

Basically what i'm trying to do is execute an update command and at the same time have the system do a TCPdump to file for that update traffic. So I would like to connect the two commands so that the tcpdump terminates automatically when the update finishes/fails/whatever. Right now I have... (0 Replies)
Discussion started by: MrEddy
0 Replies

5. Shell Programming and Scripting

executing command from subdirectories

Hello, I've been trying to run 'ls -1R | wc -l' inside of sub directories to in order to determine how big each folder is. find . -maxdepth 1 -type d | while read folder do cd "$folder" && echo "$folder has $(ls -1R | wc -l) files" && cd .. done or for... (3 Replies)
Discussion started by: NoobProgrammer
3 Replies

6. UNIX for Dummies Questions & Answers

cygwin bash startup command weirdness (part 1)

I am running (I believe) the latest stable version of cygwin CYGWIN_NT-5.1 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin on a win xp sp2 laptop. Suppose, to make things simple for now (but I may do a part 2 posting...), that I am in a dos shell, and I want to create a bash shell and have it... (1 Reply)
Discussion started by: fabulous2
1 Replies

7. HP-UX

Executing a script at startup

Hi, I want a script to execute as soon as a user logs in(instead of directing to his home directory). i know that i have to mention the path of script in the user's .profile to execute this, but not sure where and what to edit. I just tried and was unsuccesful. Kindly provide the code that i... (4 Replies)
Discussion started by: sridharr83
4 Replies

8. SuSE

Executing set of sh files at system startup

Hi Everybody I am totally new to Linux. We are using Suse Linux version 9. Currently we have 4 to 5 shell scripts which needs to be executed manually by the users.I want these scripts to be run automatically when system starts...something like system startup service. When system is... (1 Reply)
Discussion started by: appleforme1415
1 Replies

9. AIX

Not executing during startup

I have a command in my iniitab as follows: dsmc:2a:once:/usr/tivoli/tsm/client/ba/bin/dsmc sched > /dev/null 2>&1 But the command doe not appear to execute during a system boot. Not sure why. I am running AIX 5.1 Thanks for the help Mike (2 Replies)
Discussion started by: mhenryj
2 Replies
Login or Register to Ask a Question