Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-23-2013, 03:24 PM   #1
LQ Newbie
Registered: Oct 2009
Posts: 3

Rep: Reputation: 1
F19 rc.local & startup scripts not working

Hello friends

I have troubles to autostart some services on my Fedora19...

At first tried to create scripts in /etc/rc.d/init.d/ based on the existing scripts as an examle, but they do not run when the system starts... I did this

1. create a script /etc/rc.d/init.d/srv.mysql and made it rwxr-xr-x
case "$1" in
echo "Starting MySQL..."
mysqld_safe --user=mysql &
echo "Stopping MySQL..."
mysqladmin -u root -p shutdown
echo "Restarting MySQL..."
mysqladmin -u root -p shutdown
mysqld_safe --user=mysql &
echo "Starting MySQL (default)..."
mysqld_safe --user=mysql &

exit 0

Then as I found on the runlevel scripts documentation just symlinked:
/etc/rc.d/init.d/srv.mysql /etc/rc.d/rc5.d/S95srv.mysql
S to start the service and 95 was unused so I took it, runlevel 5 was reported at console by running the 'runlevel' command so I placed it in rc5.d

After reboot, it still does not run...

2. Then I tried something simpler using rc.local
I created a script /etc/rc.d/rc.local and started the services right from there:
mysqld_safe --user=mysql &
smbd -D
nmbd -D
but rc.local is not executed at system start... searching in Google I found that I must enable the service by running 'systemctl enable rc-local.service' and get this error:
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).

What can I do to enable mysql and samba at startup?

I also tried systemctl enable/start but it didn't work

[root@hexenmeister rc.d]# systemctl enable mysqld.service
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/'
[root@hexenmeister rc.d]# systemctl start mysqld.service
Job for mysqld.service failed. See 'systemctl status mysqld.service' and 'journalctl -xn' for details.

Please, tell me what is the best way to start services in Fedora 19 to do it in that way...

Thanks for your comments
Old 07-24-2013, 10:28 AM   #2
LQ Newbie
Registered: Oct 2009
Posts: 3

Original Poster
Rep: Reputation: 1
Scripts fixed and executed at boot, but mysqld dies immediatly


Finally my scripts (at init.d / rc.d) are running, I had to create them in a special format and enable them with chkconfig as specified on a small example that I found, but now I have another problem...

My script for samba works fine and starts the service, but my script for mysql starts the daemon mysqld (nohup mysqld_safe --user=mysel &) and it dies immediatly saying (the logs) that you need to start the service in a special way as root, but I specify it should be executed as the user mysql. Note that if I execute the command as root in a console it starts fine, but if I start it on rc.local or a startup script in rc.d/rc#.d it fails.

I think it is related to selinux since there are alerts when I log in saying that mysqld tried to read or read.write access /usr/lib/exec/mysqld or /var/lib/mysql/mysql/plugin.MYI or /var/lib/mysql/ibdata1 or /var/lib/mysql/ib_logfile1 or /var/lib/mysql/... that if I want to fix it I should

/sbin/restorecon -v THE_SPECIFIED_FILE_NAME

I execute the commands as specified and as root, but when I reboot to test the mysqld daemon still dies immediatly after run and selinux throws again the same errors, notice that these errors arise randomly, not always the same errors, even if I fix the problem once and again and again...

What can I do? I all the instructions that the selinux alert system says, but it does not appear to fix the problem :-/


Last edited by kanito73; 07-24-2013 at 10:30 AM.
1 members found this post helpful.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Startup scripts not working vikramtheking Solaris / OpenSolaris 5 06-14-2008 06:04 AM
added /u02/scripts/ in rc.local but not working sathyguy Linux - Newbie 4 04-14-2008 05:30 PM
Startup script not working in rc.local crackerB Linux - Software 9 10-09-2006 08:55 AM
wlan: atheros (madwifi) &startup-scripts?? c31c Slackware 4 02-20-2005 08:08 AM
Linux Startup Scripts for Oracle Application & Database research2004 Linux - Newbie 1 04-14-2004 06:22 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:08 PM.

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