[SOLVED] Place to put a certain script to be run at boot time.
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I A /etc/rc.d/rc.local (sh) Row 1 Col 1 6:13 Ctrl-K H for help
#!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local startup commands in here. Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
A little off-topic but there it goes: what should I do if I want a message written by me output to stdout just after boot to remind me a certain thing? I have tried several places but i'm defeated by the famous slack daily quotation! If it fills the screen then my message cant be read at first sight and anyways, I want it to be the very last thing printed.
A little off-topic but there it goes: what should I do if I want a message written by me output to stdout just after boot to remind me a certain thing? I have tried several places but i'm defeated by the famous slack daily quotation! If it fills the screen then my message cant be read at first sight and anyways, I want it to be the very last thing printed.
To stop fortunes from being displayed on login you can remove the executable bit on /etc/profile.d/bsd-games-login-fortune.sh (and/or /etc/profile.d/bsd-games-login-fortune.csh depending on the shell(s) you use) and it will not be run.
Code:
chmod -x /etc/profile.d/bsd-games-login-fortune.*
To display a custom message you can either add a script to /etc/profile.d/ that gets run each time you login, create a .bash_profile (or similar file for whatever shell you use) in your user's home directory that gets run whenever your specific user logs in, or edit /etc/motd to add a system-wide message (not a script) that gets displayed upon login in a login shell. Note that the motd file is modified on system boot to show the proper kernel version but only if the file's structure is correct. It should ideally look like this:
Code:
Linux 2.6.37.6
Other stuff written here...
where the version number is the kernel version number (this first line gets overwritten by rc.S).
So all executable files in /etc/profile.d get executed when an interactive login shell runs. But none of them writes stdout as I see, save for bsd-games-login-fortune.sh. Now if I want to retain this together with my message, which script will be run first (mine or bsd-games-login-fortune.sh)? Thanks for an illustrative post.
Now if I want to retain this together with my message, which script will be run first (mine or bsd-games-login-fortune.sh)? Thanks for an illustrative post.
From /etc/profile:
Code:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
I believe bash expands file listings in alphabetical order, so if you want fortune to run but you want your script to run later, you should workaround this by naming it "zzz_scriptname.sh" or something similar. Obviously a little hacky but short of renaming all files in /etc/profile.d/ to contain numbered prefixes I can't see another way around it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.