LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-07-2018, 06:43 PM   #1
Lysander666
Member
 
Registered: Apr 2017
Location: London
Distribution: Slackware 14.2 + Xfce
Posts: 803
Blog Entries: 1

Rep: Reputation: 689Reputation: 689Reputation: 689Reputation: 689Reputation: 689Reputation: 689
/etc/rc.d/rc.local vs /usr/local/share


I have a few scripts that I run on startup. I just noticed that I'd put them in two locations. What is the difference between the two? Is it not easiest just to put them all in /etc/rc.d/rc.local, or do more complex ones go in /usr/local/share? Am I conflating startup commands and startup scripts?

Last edited by Lysander666; 11-07-2018 at 06:44 PM.
 
Old 11-07-2018, 07:09 PM   #2
lougavulin
Member
 
Registered: Jul 2018
Distribution: Slackware,x86_64,current
Posts: 233

Rep: Reputation: 79
/etc/rc.d/rc.local is a script in which you can add any command you want to be executed at system startup.

/usr/local/share is directory where you can put anything that should be data architecture-independent but specific to this host. So I would not put scripts in it. For scripts, I would put them into /usr/local/bin.

So you can put scripts into /usr/local/... and call them from /etc/rc.d/rc.local.

I am not sure to be clear...
 
2 members found this post helpful.
Old 11-07-2018, 07:44 PM   #3
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,442

Rep: Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211
If you want more details on what logavulin wrote, he is referencing the Filesystem Hierarchy Standard (FHS). It is developed by the Linux Foundation and standardizes what folders should contain what files on a Linux filesystem.

The folders under /usr/ and /usr/local/ are mostly the same, but the difference is that the stuff under /usr/local/ are typically generated by a local user or admin's work, whereas the stuff in /usr/ is typically provided by packages. So, when you manually compile software, by default, it is set to go to /usr/local/, but the SlackBuilds on SBo will change that so they are installed in /usr/ (since it would be in a package recognized by the system).

/usr/share/, as well as /usr/local/share/ is supposed to contain:

Quote:
This hierarchy is intended to be shareable among all architecture platforms of a given OS; thus, for example, a site with i386, Alpha, and PPC platforms might maintain a single /usr/share directory that is centrally-mounted. Note, however, that /usr/share is generally not intended to be shared by different OSes or by different releases of the same OS.
What does all that mean? Essentially, on Slackware, that data should be identical whether on a 32bit, 64bit, or ARM system. It is the same regardless of the architecture. So, if you had a 32bit version of Slackware installed on one partition and a 64bit version installed on another partition, they should be able to share the /usr/share/ folder (unlike bin/ and lib{64}/).

As lougavulin mentioned, /usr/bin/ is used for executable scripts. If you're placing your own scripts that aren't being tracked by a package manager, I would agree that they should go in /usr/local/bin/.

Depending on what your scripts are doing, it may be worth making them rc. scripts and placing them in /etc/rc.d/. I've done that for several of the packages I maintain.
 
2 members found this post helpful.
Old 11-16-2018, 07:04 AM   #4
Lysander666
Member
 
Registered: Apr 2017
Location: London
Distribution: Slackware 14.2 + Xfce
Posts: 803

Original Poster
Blog Entries: 1

Rep: Reputation: 689Reputation: 689Reputation: 689Reputation: 689Reputation: 689Reputation: 689
Thank you, both. I think I will move everything to /etc/rc.d/rc.local. I'm actually, looking at things properly, talking about commands that are executed at startup rather than scripts, e.g. I have to have a command for ufw to start and also one to disable middle button paste for the mouse. There are one or two more, I can't remember what they are now.

Last edited by Lysander666; 11-16-2018 at 07:07 AM.
 
Old 11-16-2018, 04:28 PM   #5
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,442

Rep: Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211
Quote:
Originally Posted by Lysander666 View Post
Thank you, both. I think I will move everything to /etc/rc.d/rc.local. I'm actually, looking at things properly, talking about commands that are executed at startup rather than scripts, e.g. I have to have a command for ufw to start and also one to disable middle button paste for the mouse. There are one or two more, I can't remember what they are now.
So, rc.local is for system startups. You can add either individual commands there, or you can get fancy and write an rc. file for whatever program your interested in starting (like rc.ufw). For disabling the middle button paste on the mouse, that could be done in the rc.local, but can also be done in your favorite WM/DE's startup/autorun folders. For a few of my things, I wanted them to run after the WM/DE started, so I added them there, for everything else, I have either an rc. file for it and reference that rc. file in rc.local, or I run it directly with rc.local. Here's my rc.local.

Code:
# Start the Sickrage Daemons:
if [ -x /etc/rc.d/rc.sickrage-completed ]; then
  sh /etc/rc.d/rc.sickrage-completed start
fi

if [ -x /etc/rc.d/rc.sickrage-ongoing ]; then
  sh /etc/rc.d/rc.sickrage-ongoing start
fi

# Start vboxdrv
if [ -x /etc/rc.d/rc.vboxdrv ]; then
  /etc/rc.d/rc.vboxdrv start
fi

# Start vnstat
if [ -x /etc/rc.d/rc.vnstat ]; then
  /etc/rc.d/rc.vnstat start
fi

# Load CPU/Mobo sensor module
/sbin/modprobe nct6775

# Start fail2ban:
if [ -x /etc/rc.d/rc.fail2ban ]; then
  sh /etc/rc.d/rc.fail2ban start
fi

# Start the VPN
if [ -x /etc/rc.d/rc.openvpn ]; then
  sh /etc/rc.d/rc.openvpn start
fi

# Start transmission
if [ -x /etc/rc.d/rc.transmission ]; then
  /etc/rc.d/rc.transmission start
fi

# Start nginx for transmission
if [ -x /etc/rc.d/rc.nginx ]; then
  /etc/rc.d/rc.nginx start
fi
As you can see, I mostly use rc. files, and technically, I should be able to load modules with rc.modules (but I've never bothered looking into it). Most of those rc. files were already created, but I did create my own rc.openvpn and rc.transmission files to ensure transmission would only run under my vpn and I also created the rc.sickrage files (which I then added one to the sickrage package I maintain on SBo).
 
1 members found this post helpful.
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /usr/local/share/man not in MANPATH andygoth Slackware 9 07-13-2018 04:40 AM
Change shipped Perl package compile options to use /usr, not /usr/local xj25vm Slackware 7 02-03-2017 07:42 AM
/usr vs /usr/local (& /opt) when describing non system software (debate welcomed) Alpha90 Linux - Software 2 07-07-2012 04:22 AM
/usr/local/lib or /usr/local/lib64 rigelan Slackware 9 07-24-2009 07:32 PM
Frustration: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0 nidala Linux - Newbie 1 09-28-2008 12:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:08 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration