SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Okay, I am new to linux so I need some very detailed instructions. I have a Salckware 10 server at home that I am running a Battlefield 1942 server on along with the Blackbag Ops server manager.
I have the server in /usr/local/games/bf1942 and want to run a file called "bfsm" on startup.
All this so I just have to reboot it and I can log back into the Server Manager and start the server again.
I have no idea how to do this and I have searched these forums for what feels like days to find help and haven't crossed anything. Can someone please give the new guy a hand..
Originally posted by Munniac Okay, I am new to linux so I need some very detailed instructions. I have a Salckware 10 server at home that I am running a Battlefield 1942 server on along with the Blackbag Ops server manager.
I have the server in /usr/local/games/bf1942 and want to run a file called "bfsm" on startup.
All this so I just have to reboot it and I can log back into the Server Manager and start the server again.
I have no idea how to do this and I have searched these forums for what feels like days to find help and haven't crossed anything. Can someone please give the new guy a hand..
Thanks
Mike
Does bfsm run as a background process or is it in the foreground? i.e. when you type bfsm from the command line does it return you to the command line or does it display the server in the terminal until you shutdown the server? Also under what user account does the server run? Finally what is the command to shutdown the server?
You are going to want to add a line or two to /etc/rc.d/rc.local but it will depend on how it runs as to what the command should be.
in your /etc/rc.d/rc.local
(it will run in background as all servers do)
I tried "/usr/local/games/bf1942/bfsmd &" and "/usr/local/games/bf1942/bfsmd" in my rc.local and it didn't work.
I also did a which bfsmd and got this error.
which: no bfsmd in (/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt/bin)
I figured if it was going to run in the startup script it should run with me just typing it in. I typed in /usr/local/games/bf1942/bfsmd and got this error...
Couldn't find server binary in /root! Use -path to specify server directory and/or verify bf1942_lnxded link exists.
so I put in this script and it worked so I added it to the rc.local
The server might not run as root. In which case the sticky bit would need to be set or he sould want to use su - <user> -c "<command>" The easiest way to test is to set up your rc.local, then from the command line as root type "/etc/rc.d/rc.local" and see what it has to say.
Also keep in mind that if the bf1942 server needs to be shutdown a command will need to be added to /etc/rc.d/rc.0 as well. My personal preference, which may be overkill for a simple example, is to set up a script for the server with start, stop, and restart commands (just copy rc.httpd and modify to suit). I then add a call to start in rc.local and stop in rc.0. The benefit is that your added server is consistent with services in a default Slackware install.
From the looks of it the bf1942 server is not freely available so I can't install it. If it is free, let me know where it is and I'll install and write a startup script.
This is an example rc.server script (postgres in this case)
Code:
#!/bin/sh
#
# /etc/rc.d/rc.postgres
#
#
case "$1" in
'start')
su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -l /var/log/postgres/postgres -o '-i'" ;;
# a GUESS as to what the bf1942 command should be
# NOTE: I am wrapping it in a su-c because I don't like to run anything as root that does not
# need to be and su -c is my preferred way versus setting the sticky bit
# su - bf1942User -c "/usr/local/games/bf1942/bfsmd &" ;;
# alternatively you could start bfsmd in a screen like this
# su - bf1942User -c "screen -d -m /usr/local/games/bf1942/bfsmd" ;;
'stop')
su - postgres -c "/usr/local/pgsql/bin/pg_ctl stop -D /usr/local/pgsql/data" ;;
#same procedure as above but use whatever the stop command is
'restart')
su - postgres -c "/usr/local/pgsql/bin/pg_ctl restart -D /usr/local/pgsql/data" ;;
#simplest way would be to copy the stop and start commands here.
*)
echo "usage $0 start|stop|restart" ;;
esac
then add a "rc.bf1942 start" to rc.local and "rc.bf1942 stop" to rc.0
If you could get me a script that starts and stops it, that would be awesome. I have it starting when linux boots, but is it bad to just let it die when the server reboots, what is the advantage of your script to the on that I have on there now? I am just curious because as I stated, I am not a guru, YET.
OK, I am downloading now. I'll set it up later tonight. The benefit to setting it up the way I suggested is that you can start and stop the server from the command line as well as having the service start and stop automatically. Also to enable/disable the service all you would need to do is change the permission to the script. Finally, as I noted, the way you are running it currently the bf1942 server is running as root, which in my opinion is not wise. Any vulnerability in the server would be effectively exploiting root permission.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.