[SOLVED] Run a command on start-up?

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[SOLVED] Run a command on start-up?

Postby rgusnowski » Jun 25th, '14, 02:34

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
Last edited by rgusnowski on Jun 29th, '14, 17:30, edited 1 time in total.
rgusnowski
 
Posts: 12
Joined: Jun 25th, '14, 02:25

Re: Run a command on start-up?

Postby benmc » Jun 25th, '14, 03:00

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.
benmc
 
Posts: 1218
Joined: Sep 2nd, '11, 12:45
Location: Pirongia, New Zealand

Re: Run a command on start-up?

Postby rgusnowski » Jun 25th, '14, 03:20

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
rgusnowski
 
Posts: 12
Joined: Jun 25th, '14, 02:25

Re: Run a command on start-up?

Postby jkerr82508 » Jun 25th, '14, 04:18

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
jkerr82508
 
Posts: 946
Joined: Mar 26th, '11, 01:34
Location: Fife, Scotland

Re: Run a command on start-up?

Postby daniewicz » Jun 25th, '14, 05:19

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
#
The dude abides.
User avatar
daniewicz
 
Posts: 224
Joined: Feb 10th, '13, 03:37

Re: Run a command on start-up?

Postby rgusnowski » Jun 25th, '14, 14:53

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.
rgusnowski
 
Posts: 12
Joined: Jun 25th, '14, 02:25

Re: Run a command on start-up?

Postby jkerr82508 » Jun 25th, '14, 16:36

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
jkerr82508
 
Posts: 946
Joined: Mar 26th, '11, 01:34
Location: Fife, Scotland

Re: Run a command on start-up?

Postby jiml8 » Jun 25th, '14, 18:37

If you mark your rc.local to be executable, systemd will automatically pick it up at startup.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: Run a command on start-up?

Postby rgusnowski » Jun 26th, '14, 01:54

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
rgusnowski
 
Posts: 12
Joined: Jun 25th, '14, 02:25

Re: Run a command on start-up?

Postby isadora » Jun 26th, '14, 06:58

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. ;)
..........bird from paradise..........

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
—Antoine de Saint-Exupéry
User avatar
isadora
 
Posts: 2766
Joined: Mar 25th, '11, 16:03
Location: Netherlands


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest