Questions tagged [rc.local]

30 questions
32
votes
4 answers

Execute script from rc.local as user instead of root

I want to execute a script every time my server start up. The problem is that I need to be a certain user to execute the script, if I try to do it as root it cant find certain packages (such as ruby). I try to change to xxx user01. sudo su…
Philip
  • 375
  • 1
  • 4
  • 8
6
votes
2 answers

Restoring iptables at boot (rc.local)

I have saved my iptables rules using the iptables-save > command and i am trying to restore these rules when the machine boots up. I have added the command iptables-restore < "path to rules file" in the rc.local but it doesn't fire up the rules. I…
Troller
  • 171
  • 1
  • 4
6
votes
4 answers

postgresql on Ubuntu 10.4 doesn't start on boot

I'm trying to have postgresql 8.4 start on boot on Ubuntu server 10.04 (64bit). First, I tried putting: su -c 'pg_ctl start -D /home/postgres -l /home/postgres/serverlog' --preserve-environment postgres at the end of init.d/rc.local, to no avail.…
vivri
  • 203
  • 2
  • 10
5
votes
1 answer

startpar process left hanging when starting processes from rc.local or init.d

I have a peculiar issue when starting ongoing(service-like) processes from either full blown init.d script (SysV style) or a simple one-line call from rc.local file like so: su someuser -c "/home/someuser/watchdog.sh &" Where watchdog.sh contains…
Ivan Kovacevic
  • 1,671
  • 3
  • 14
  • 19
5
votes
2 answers

Getting Xvfb to start upon booting system in Ubuntu Maverick

I'm trying to get Xvfb to run when the system starts up on Ubuntu 10.10 (Maverick), but it's not working. In /etc/rc.local, I have the following: /root/start_xvfb.sh >> /var/log/start_xvfb.log 2>&1 exit 0 And in /root/start_xvfb.sh I…
user75894
  • 153
  • 1
  • 3
4
votes
3 answers

How to test /etc/rc.d/rc.local to make sure a command will start successfully at boot?

I'm using tyrantmanager to manage several instances of Tokyo Tyrant. It's working fine. I want to get it to start at boot, so I add the following command into /etc/rc.local: /usr/local/bin/tyrantmanager start --home=/data/tyrant/ (this will be OK…
quanta
  • 50,327
  • 19
  • 152
  • 213
4
votes
2 answers

Why does rc.local require absolute paths? How can I run a script at startup that doesn't use them?

I have a script that runs at startup from rc.local in CentOS. This script contains a command to compile my erlang project using a third party build command called rebar. The rebar line fails to compile my project at startup, but if I then run it…
mwt
  • 43
  • 1
  • 4
3
votes
1 answer

Run python script inside /etc/rc.local doesn't work

I modified /etc/rc.local on my Amazon AWS AMI #!/bin/sh touch /var/lock/subsys/local # setup hostname properly /usr/bin/python /root/automation/initSystem.py so last line calls Python script that does configuration (Env variables, hostname,…
DmitrySemenov
  • 755
  • 2
  • 14
  • 27
3
votes
2 answers

/etc/rc.local not being run on Ubuntu Desktop Install

I have been trying to get sphinx to run at boot, so I added some lines to /etc/rc.local but nothing happens when I start up. If i run it manually it works however. /etc/init.d/rc.local start works fine as does /etc/rc.local It's listed in the…
loosecannon
  • 131
  • 1
  • 4
2
votes
1 answer

Run rc.local only once Mongodb is running in CentOs 7

I have the following script in my rc.local: This runs the services on ports 8080, 8081, 8082, 8083. They are actually node servers that NEED mongod to startup. So, I edited /lib/systemd/system/rc-local.service and added: After=network.target…
Merc
  • 719
  • 1
  • 6
  • 16
2
votes
1 answer

Start Rails on boot for AWS EC2

i have a ubuntu EC2 instance and i want start my rails server at boot. So i have a script: start.sh #!/bin/bash # # Start Rails Server cd ~/spree rails server -d and i have this in my rc.local: rc.local #!/bin/sh -e # # rc.local # sudo -u ubuntu -i…
SaroVin
  • 130
  • 3
2
votes
2 answers

rc.local not being run on Fedora 23

I have an iptables script I want to run at boot. I created /etc/rc.d/rc.local file with CHMOD 755 permissions which have worked on previous operating systems. Root owns the file. I also have #!/bin/bash as the first line. I have also tried…
xivix
  • 543
  • 2
  • 8
  • 15
2
votes
3 answers

Slackware scripts started at boot time need env vars from /etc/profile.d/* to be set

Hey, I have this problem, that scripts started at boot time from rc.local don't have environment variables (defined at /etc/profile.d/*) set at the time of their startup. What should I do ? "su - lisak -c…
lisak
  • 637
  • 2
  • 7
  • 19
1
vote
3 answers

Debian 9 - rc.local deprecated, how to launch python at startup

I am slightly lost, I have a Debian 9 server and a Python Flask script that I am trying to launch at startup. In the past I have used rc.local to launch things at startup but from reading it seems that it is now deprecated. Can anyone tell me what…
fightstarr20
  • 207
  • 1
  • 4
  • 12
1
vote
2 answers

Read Ahead value automatically getting updated at boot

OS version: CentOS Linux release 7.2.1511 (Core) I have the following commands in my rc.local file: /usr/sbin/blockdev --report > /root/test_boot /usr/sbin/blockdev --setra 256 /dev/vdb /usr/sbin/blockdev --report >> /root/test_boot After booting…
1
2