LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 02-05-2012, 01:22 AM   #1
susja
Member
 
Registered: May 2011
Posts: 61

Rep: Reputation: 0
Where to put startup scripts?


Hello,
1. I'm using Fedora 16. I'm looking for a way to automatically start and stop VNC server (because it doesn't start itself when I login). I think that I could put 'vncserver' command in a script to start when system comes up. My question is: where should I put this script?
2. I'm not sure if I have to kill VNC process when systerm logout or rebooted but I think it won't harm hence my second question: where should I put a script to be executed when system logout?
3. I also have to run commmand iptables -F in order to open ports. This commands should run as root. Hence question: where should I put it and how to make it to run as root?
4. Maybe there other ways to control which scripts/commands will run during setup/logout and they are graphical? I'm simply not aware of it.
Could someone give me some help on it?
Thanks,
 
Old 02-05-2012, 01:38 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,487

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
F16 has gone (almost) completely to systemd - have a read of this.
Were you to google your problem, you'll see references to using rc.local (/etc/rc.local) - this will still work with F16. Don't bother with shutting it down if it won't recognise old-style init scripts.
 
Old 02-05-2012, 02:05 AM   #3
susja
Member
 
Registered: May 2011
Posts: 61

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
F16 has gone (almost) completely to systemd - have a read of this.
Were you to google your problem, you'll see references to using rc.local (/etc/rc.local) - this will still work with F16. Don't bother with shutting it down if it won't recognise old-style init scripts.
hi,
thanks for reply but I don't see rc.local on my system. I only have this:
ls /etc/rc.*
init.d rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d
 
Old 02-05-2012, 02:54 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,487

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Sorry, meant to mention - just create the file (as root), make it executable, and add your (local) commands there.
It won't get over-written by Fedora updates.
 
Old 02-05-2012, 03:23 AM   #5
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Not trying to complicate things, but you might also want to check for /etc/init.d/rc.local

My Ubuntu system stores it there. I understand that Ubuntu != Fedora. If I had a Fedora virtual machine, I would verify before I replied. But, unfortunately I don't...
 
Old 02-05-2012, 03:35 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,487

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Thank you @Dark_Helmet - you are absolutely correct.
Me shooting from the lip instead of checking - should actually be /etc/rc.d/rc.local in F16. See 3.2.4 in this doco.

Last edited by syg00; 02-05-2012 at 03:39 AM. Reason: corrected - added link
 
Old 02-05-2012, 03:42 AM   #7
susja
Member
 
Registered: May 2011
Posts: 61

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
Thank you @Dark_Helmet - you are absolutely correct.
Me shooting from the lip instead of checking - should indeed be /etc/init.d/rc.local in F16.
thank you folks for reply but unfortunately none of you suggestion worked.
As a root I created executable file /etc/init.d/rc.local and put only one line inside it i.e. /usr/bin/vncserver
I tested that if I execute this file it start VNC server which is my goal.
Unfortunately after I rebooted the system VNC server didn't run which means that likely that file wasn't executed.
Regards.
 
Old 02-05-2012, 04:14 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,487

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Yeah, sorry about that - I was watching the cricket instead of concentrating.
Check my update to my post just prior to you posting.
 
Old 02-05-2012, 05:40 AM   #9
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi,

Maybe it was just a little mismatch in the path:
Code:
$ ls /etc/rc*
lrwxrwxrwx  1 root root   13 Nov 18  2009 /etc/rc.local -> rc.d/rc.local*
this is a symlink to 

$ ls /etc/rc.d/rc.local 
-rwxr-xr-x 1 root root 385 Nov 16 23:27 /etc/rc.d/rc.local*


$ cat  /etc/rc.d/rc.local
touch /var/lock/subsys/local
$
This is a working file on my CentOS / RHEL server

good luck
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Openvpn: where do I put the bridge startup scripts? MikeyCarter Linux - Software 2 09-13-2010 08:08 AM
Best directory to put my own scripts in...?? WhisperiN Linux - Software 19 11-08-2009 08:50 AM
where to put "global X startup" scripts? minike Slackware 6 03-10-2007 04:15 PM
How to put scripts in the startup..? balavignesh Linux - Software 1 08-28-2006 11:43 AM
Mandriva startup scripts (need to add something to startup before X starts) thunderweasel Mandriva 3 01-01-2006 01:55 AM


All times are GMT -5. The time now is 10:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration