Startup a File (Image, Song, Video, Text, etc) on boot or Login?

Eddie Paul Litz

Active Member
Credits
237
How do I setup a file (Image, Song, Video, Text, etc) to startup on boot or login?
 


carlarogers

New Member
Credits
115
Anything you want started at login can be done by adding the commands to certain files that are read when logging in. Figuring out exactly which files are the ones that apply to your your system is a tricky topic. I am going to try providing a simple explanation, without totally ignoring the complications.

The exact file or files where you can put a command to run at login varies by distro and shell. However, the variations are not tremendously different. Your basic goal is to find at least one file where you can put a command to run at login. When you have identified or created a file you think might be valid for your system, you can test it by putting a simple command in the file and looking to see if it runs at login. For this purpose, I use

Code:
echo 'This ran at login.'
Next time you login, look for "This ran at login." among the rest of the login messages that come up. If you see it, then you can replace that echo command for whatever you want to run at login. Ideally, you will place that test command to run after everything else in your login process, so the system will have already setup the environment where you are going to run your command. Otherwise, you might have problems getting your command to run, because, for example, paths are not set.

Hints For Finding or Creating a File to Run at Login

I have my accounts setup to run bash as the shell. Bash looks in a few places for files to run at login. First it looks in /etc/profile. Then it looks in the home directory of the account for either .bashrc or .bash_profile. It looks in one or the other depending on whether the shell is a login shell , interactive shell, which I do not undrstand well at all. For me it makes no difference, because thanks to the defaults of the distro, when an account is created, the .bash_profile contains code that tells it to run .bashrc. So, I put the commands I want to run in ~/.bashrc.

Hopefully, this is enough to get you down the road.
 

Eddie Paul Litz

Active Member
Credits
237
Does anyone else have any ideas?
 

Condobloke

Well-Known Member
Credits
2,424
The post by @carlarogers is worth a second look. .... Combine that with the info in @sp331yi's link and you should have a good idea how to proceed
 

Eddie Paul Litz

Active Member
Credits
237
Is there a much easier way to do it or is that the only way to do that?
 


Members online


Top