(SOLVED) Where is the best place to put commands/scripts to survive the reboot process?


TechMed

Recommended Posts

Hi All,

 

Early Happy Holidays to everyone! 🎅

 

So, I decided to revisit Wake-On-Lan (WOL) for my SuperMicro X10DAC board which is my primary unRAID server (#1 of 4). All my others have IPMI and work well.

As #1 was my first unRAID build, and subsequently the beefiest, it serves most of data and media needs to our family.

 

However, there are periods of time (sometimes days) where it is simply unnecessary for the system to be up, so I would like it to sleep.

Sleep process was/is accomplished (thank you @bonienl for the great Sleep plugin), and after a little digging at SlackWare.org, and a tweak to the eth0 profile related to WOL, I am now able to wake #1 with a Magic Packet.

 

However, the "tweak" to the eth0 profile does not survive reboots. So, my question is: where is the best place to put options/custom scripts/settings/commands to survive the reboot process?

 

Currently, I specifically need to add " ethtool -s eth0 wol g " somewhere so it survives reboot. But, as my knowledge of unRAID grows and I experiment more with custom scripts etc, I would also like to know where to add them too, so they survive reboot.

 

Thanks much!

Edited by TechMed
Question answered with a solution!
Link to comment

There are two locations within the Unraid Linux file system that survive a reboot: the boot flash device that's mounted at /boot and the array and cache disks that appear under /mnt. The rest is in RAM and is lost when you reboot. For your particular need there's a file called /boot/config/go (i.e. config/go on the boot flash device). Simply add the line

ethtool -s eth0 wol g

to it and it will be run every time your reboot.

Link to comment
46 minutes ago, John_M said:

There are two locations within the Unraid Linux file system that survive a reboot: the boot flash device that's mounted at /boot and the array and cache disks that appear under /mnt. The rest is in RAM and is lost when you reboot. For your particular need there's a file called /boot/config/go (i.e. config/go on the boot flash device). Simply add the line


ethtool -s eth0 wol g

to it and it will be run every time your reboot.

@TechMed, if you do this, be sure that you use a Linux aware editor!  I use EditPad Lite.  I believe that NotePad++ is another Linux aware editor.  

Link to comment
6 minutes ago, Squid said:

Although its good practice to be in, the go file though is allowed DOS endings (Notepad will work no problems)

Both of my  go files have Linux line endings in them and that was what I based my recommendation on.  What I can't figure out is which files can allow either Linux and/or DOS line endings.  As a result, I always use a Linux aware editor.  (Although, I suspect that the smb-extra.conf is one since it is not one of the standard Unraid config files...) 

Link to comment

Yeah, @limetech's not super consistent on line endings on the flash drive files LMAO

 

go - DOS endings

All the share's .cfg files - DOS endings

All the .cfg files in /config - DOS endings except for domain.cfg and docker.cfg - Linux endings

Any .conf file - Linux endings

Any .cfg file in /config/plugins/*/* - Linux endings

 

In a perfect world, everything on the flash drive would be DOS endings to make things easier for the end user.  But its no doubt such a low priority that no one cares to get them consistent (including myself ;) )

 

Edited by Squid
Link to comment
23 minutes ago, bonienl said:

In the perfect world none of the *.cfg files should be edited directly by the user. These are all auto-generated files.

 

Until the world gets perfect, config file editor fills the gap nicely :) 

 

New tag line for the CA branded plugins: "Making the world perfect"

Edited by Squid
Link to comment

Problem is that in the DOS (MS) world, line endings are LF/CR,

                        in the MAC world, line endings are CR

                        in the Linux/UNIX world, they are LF.

 

I think we have folks using as PC's with all three of these environments.  Who is to say what a perfect world.  I think that anyone using Unraid ought to be using an editor that recognizes which of the three the file is using and adjust its behavior to follow that file's settings when a new line of text is entered into the file.

 

PS: For those who are confused, LF= line feed (ascii  code 10), CR= carriage return (ascii code 13).  Back in the old days, a carriage return as defined as simply returning the print head back to the beginning of the line (allowed printing of the line twice).  A line feed advanced the page up for a blank line to print on.  (A line feed left the print head in its present location.)  I can remember printers having settings (toggle switches if memory serves) to be able to accommodate these three conditions so that final printout was what the user wanted. 

Link to comment
1 hour ago, bonienl said:

In the perfect world none of the *.cfg files should be edited directly by the user. These are all auto-generated files.

That's definitely how things have evolved.

 

Originally, in Unraid v1.0 days, as a last step before ejecting the flash from your windows PC, the instructions had users optionally use Notepad to edit some of the files on the flash, for example, config/ident.cfg to set the server name and config/network.cfg to set the server IP address.  Thus these files needed windows-style line endings.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.