Page 1 of 1
[SOLVED] Run a command on start-up?

Posted:
Jun 25th, '14, 02:34
by rgusnowski
Hi
I was wondering if someone could help me out.
I have Mageia installed on an HP6930P, it has a built in Intel ABGN 5300, and for some reason when Mageia boots, it does a hardware disable of the network card.
After searching through the net, I have found that others have had similar problems, but not all the solutions were the same, and only one worked for me.
If I want to get the Intel card working, I have to open up a console, su to root, and issue the command "rfkill unblock all". As soon as I do that, the Intel wireless turns on, and I am able to use the connection.
There must be a way to add this line in to a script to run sometime after the network commands finish. I tried to created a script for rc.local, and have the command there, but rc.local doesn't seem to be processed during startup. It has been a few years since I used Linux, and a few things have changed. Not having rc.local is one of those changes.
Can someone suggest how to issue the command "rfkill unblock all" during the boot sequence so the wireless comes up automatically?
Thanks
Robert
Re: Run a command on start-up?

Posted:
Jun 25th, '14, 03:00
by benmc
Hi
I know this doesn't answer your request but have you enabled the " network and internet configuration " wizard to start the connection at boot?
regards.
Re: Run a command on start-up?

Posted:
Jun 25th, '14, 03:20
by rgusnowski
Yes I have.
Right now I am using a USB wireless adapter.
The issue is specific to the Intel 5300. When the network starts, the regular linux driver causes the adapter to disable itself. As mentioned, I am not the only one with this issue. It is specific to the Intel 5300, and it is even fussier in HP laptops. HP chose to solder the wireless to the MB, so I can't even swap it out.
However I do know how to make it work as described in my first post. Now I want to automate that solution.
Thanks
Robert
Re: Run a command on start-up?

Posted:
Jun 25th, '14, 04:18
by jkerr82508
One option may be to create a bash script file that includes the necessary command. Name the bash script file rc.local, make it executable and place it in /etc/rc.d When your system boots, systemd's rc-local.service will cause the script to be executed.
Jim
Re: Run a command on start-up?

Posted:
Jun 25th, '14, 05:19
by daniewicz
Robert,
What Jim said. I don't know what level of experience you have so I am showing you my rc.local:
- Code: Select all
#!/bin/sh
#
# run 'set' values for the sensors specified in /etc/sensors3.conf and monitored with lm_sensors
sensors -s
#
# stop service udisks2
service udisks2 stop
#
# disable SMART polling of WD drive /dev/sdb
smartctl -s off /dev/sdb
#
# restart service udisks2
service udisks2 start
#
Re: Run a command on start-up?

Posted:
Jun 25th, '14, 14:53
by rgusnowski
I had an executable file named etc/rc.d/rc.local, but it wasn't starting automatically.
What is the full path to rc.local?
I read one post where there had to be changed made to get rc.local to run, and it didn't make sense to me.
If you could confirm the correct path to the rc.local executable, I will try that.
Thank you for the help.
Re: Run a command on start-up?

Posted:
Jun 25th, '14, 16:36
by jkerr82508
The correct path is /etc/rc.d/rc.local. In other words it is in the rc.d directory, which is in the etc directory in the / partition.
- Code: Select all
[jim@mageia-compaq ~]$ locate rc.local
/etc/rc.d/rc.local
Your rc.local should probably be something like this
- Code: Select all
#!/bin/bash
# to prevent network device from being disabled
rfkill unblock all
I usually add a blank line at the end of files like this. Some files won't work without it.
Jim
Re: Run a command on start-up?

Posted:
Jun 25th, '14, 18:37
by jiml8
If you mark your rc.local to be executable, systemd will automatically pick it up at startup.
Re: Run a command on start-up?

Posted:
Jun 26th, '14, 01:54
by rgusnowski
Jim
Thank you - it worked.
I thought there was a problem after the first reboot as the LED indicator for the wireless didn't switch from "orange" to "blue" (showing that the interface is alive) until after I logged in.
After a second reboot I waited at the login screen - it took about 15-20 seconds - but the interface lit up, and the wireless was running. Rc.local must be one of the last services to load up, but it is working.
My next step is figuring out the new TigerVNC/x11VNC. I have a question posted on that, but have yet to see any suggestions. As I said, I have been away from "hands on" Linux for a few years, and some things have changed. What happened to TightVNC?
Thanks again for your help.
Robert
Re: Run a command on start-up?

Posted:
Jun 26th, '14, 06:58
by isadora
Please rgusnowski, mark the topic accordingly.
Do so by writing [SOLVED] in front of the title/subject of the first message in this topic, thanks ahead.
