LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices



Reply
 
Search this Thread
Old 05-09-2012, 12:02 AM   #1
shadowbox12
Member
 
Registered: Mar 2010
Posts: 52

Rep: Reputation: 3
resume scripts timing


I have a startup script that changes my MAC address for me, but I noticed that after a successful suspend/resume it was changed back. So I did some research and put together a resume script that changes it back. I put in in /etc/pm/sleep.d/99_changemac-suspend. It actually points back to the original script in /etc/init.d that does the MAC change on boot and outputs $1 to a file so I can see that it ran and with what input.

The script runs fine when I execute it manually and I can tell it runs on resume because the output file shows the expected input of "resume", but my MAC is not as it should be. I can only assume that even with a start order of 99 something else is running after it which reinitializes the NIC and loses my custom settings.

What can I do to troubleshoot this issue? Is there a way to force my script to run last?

{edit} I'm using 11.11

Last edited by shadowbox12; 05-09-2012 at 12:03 AM.
 
Old 05-09-2012, 04:51 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,590

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Why are you not using udev rules for this?

---------- Post added 05-09-12 at 01:52 PM ----------

http://www.debianhelp.co.uk/udev.htm
 
Old 05-11-2012, 08:19 PM   #3
shadowbox12
Member
 
Registered: Mar 2010
Posts: 52

Original Poster
Rep: Reputation: 3
I got my hopes up on this, but looking at the rulesets (http://linux.die.net/man/8/udev) I don't see one that allows you to specify a new MAC address the same way you can change the name. The best thing I could find was PROGRAM which allows you to run a program on a match.

So I made a rule like so:
# PCI device 0x8086:0x4222 (iwl3945)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:de:5b:6a:91", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan2", PROGRAM=="/etc/init.d/changemac"

But it doesn't have the intended result of changing my mac. Any other ideas?
 
  


Reply

Tags
hibernate, resume, scripts, suspend


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripts to run after resume from sleep brixtoncalling Slackware 2 09-06-2009 04:27 PM
Suspend/Resume - custom scripts and mouse issues Arcalyth Linux - Laptop and Netbook 0 02-17-2009 06:30 PM
fedora core 5 boot, suspend, and resume scripts? dansawyer Fedora 1 08-23-2006 07:22 PM
how to start timing and print the timing result on portions of java codes ?? alred Programming 2 05-15-2006 11:00 AM
Suspend / Resume scripts on slackware 9 boney Slackware 0 06-19-2003 03:09 AM


All times are GMT -5. The time now is 11:45 AM.

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