LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux Mint
User Name
Password
Linux Mint This forum is for the discussion of Linux Mint.

Notices

Reply
 
LinkBack Search this Thread
Old 11-05-2013, 09:56 PM   #1
CW_OP
LQ Newbie
 
Registered: Apr 2012
Location: Newcastle, Wa.
Distribution: Slackware 13.37
Posts: 11

Rep: Reputation: Disabled
Angry Script not running at startup


Hello I am trying to get a macchanger script to work on start up.
I am running Linux Mint 15 and the macchanger program is installed.
I followed the directions from this linux mint site.

http://community.linuxmint.com/tutorial/view/376

Here is my script and errors:

The directory my file is in.
dgreene-1025C init.d # pwd
/etc/init.d

The permissions and ownership of my file.
ls-al | more
-rwxr-xr-x 1 root root 146 Nov 5 19:06 changemac

dgreene-1025C init.d # cat changemac
#!/bin/bash
ifconfig eth0 down
ifconfig wlan0 down
/usr/bin/macchanger -r eth0
/usr/bin/macchanger -r wlan0
ifconfig eth0 up
ifconfig wlan0 up

Cannot enable script to execute at startup recieve the following error.

dgreene-1025C init.d # update-rc.d changemac defaults
update-rc.d: warning: /etc/init.d/changemac missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
System start/stop links for /etc/init.d/changemac already exist.

However script runs fine when executed at command line.

dgreene-1025C init.d # ./changemac
Permanent MAC: 10:bf:48:33:8e:2a (unknown)
Current MAC: 04:55:03:89:64:ad (unknown)
New MAC: f2:04:1e:7c:f9:43 (unknown)
Permanent MAC: 94:db:c9:a1:8f:67 (unknown)
Current MAC: 94:db:c9:a1:8f:67 (unknown)
New MAC: c6:a9:31:71:8e:21 (unknown)

When I restart the script does not run.
Can anyone see what I am doing wrong?
 
Old 11-06-2013, 01:42 AM   #2
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,258

Rep: Reputation: 385Reputation: 385Reputation: 385Reputation: 385
you could try reading http://wiki.debian.org/LSBInitScripts

I got that link from the error you posted

alternatively, just manually create a symlink in the appropriate runlevel dir

example

Code:
ln -s ../init.d/changemac /etc/rc3.d/S02changemac
Warning:
I have made no effort to select appropriate runlevel ( rc3.d ) or 'start order' ( S02 )
just an example
 
Old 11-06-2013, 07:49 PM   #3
CW_OP
LQ Newbie
 
Registered: Apr 2012
Location: Newcastle, Wa.
Distribution: Slackware 13.37
Posts: 11

Original Poster
Rep: Reputation: Disabled
Script not running at startup

I removed the script from /etc/init.d directory and put it in the /etc/rc.local file. I ommited the #!/bin/bash and used the #!/bin/sh that was in the rc.local file. Now the script runs at startup perfectly!

Got the idea from this link.

http://www.ghacks.net/2009/04/04/get...itd-directory/
 
Old 11-06-2013, 08:08 PM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,258

Rep: Reputation: 385Reputation: 385Reputation: 385Reputation: 385
well, not perfectly

it runs after everything else like your network starting

I guess it doesn't really matter, but I don't know why you need to change your macaddress

also, the answer *was* in your question
 
Old 11-26-2013, 12:23 PM   #5
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-15 with Cinnamon & KDE
Posts: 1,272
Blog Entries: 3

Rep: Reputation: 86
Your discussion of /etc/init.d and /etc/rc.local are topics surrounding what is known as "System-V Init Scripts".
see http://askubuntu.com/questions/34642...v-init-scripts
... The "System-V" refers to AT&T(R) Unix(tm) "System Five."
see http://en.wikipedia.org/wiki/Unix_System_V

Linux Mint-15 (derived from Ubuntu 13.04) uses a different approach to system initialization called "Upstart."
see http://en.wikipedia.org/wiki/Upstart
Upstart has "features" that look like and work like System-V Init.

There is also another approach to system initialization called systemd (for "system daemon").
see http://en.wikipedia.org/wiki/Systemd
I am not aware of systemd use in the Mint or Ubuntu distributions.

Regards,
~~~ 0;-Dan
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Running a script at startup andperry Linux - Newbie 5 04-30-2012 04:43 AM
iptables startup script not running Shwick Ubuntu 8 10-03-2008 07:03 AM
Running Script on Startup jCash Linux - Newbie 3 05-20-2007 08:45 PM
Running a bash script at startup linker3000 Linux - Software 2 05-17-2007 10:00 PM
running .pl script on startup knowram Other *NIX 2 03-09-2007 09:50 PM


All times are GMT -5. The time now is 08:16 AM.

Main Menu
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