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.
running slackware 10
I would like to have a program run when I log in from the non GIU interface, the basic one with slack. I just dont know where to add the script. Its a program that all users have access to.
I see alot of post regarding starting a program at boot, but few regarding login, that have helped.
One post did say it does not matter to start a program at login, that you can just start it at boot, and every user will be able to access it
PS it needs an internet connection to work, so I would need it to run after my internet connection has been established
Add your script to ~/.bash_profile. As I understand it .bash_profile is only executed when you first login, not like ~/.bashrc which is executed for every instance of bash
Thanks, I found it along with some other interseting things.
Is there anything I have to include in there other then the path to the program I want to run, along with the program name. cause it did not work when I logged on.
Thanks, I found it along with some other interseting things.
Is there anything I have to include in there other then the path to the program I want to run, along with the program name. cause it did not work when I logged on.
example... /directory/directory/program_to_run
thats the only line in my .bash_profile
If the program you want to run is in your path:
Quote:
echo $PATH
Then you only have to type the name of the program to call it.
If it is not in your path then you have two choices:
1. Use absolute paths to call it, i.e., /usr/local/bin/program & (use & to send it to the background so you still have access to your console/xterm).
2. Put the program in your path. For example, if the program in question is in /usr/local/bin , but /usr/local/bin is not in your path then you need to issue the follwoing:
Quote:
export PATH=$PATH:/usr/local/bin
Another way to see your PATH is to type "env" without the quotes. This will bring up all your environment variables.
Then you only have to type the name of the program to call it.
If it is not in your path then you have two choices:
1. Use absolute paths to call it, i.e., /usr/local/bin/program & (use & to send it to the background so you still have access to your console/xterm).
2. Put the program in your path. For example, if the program in question is in /usr/local/bin , but /usr/local/bin is not in your path then you need to issue the follwoing:
Another way to see your PATH is to type "env" without the quotes. This will bring up all your environment variables.
LocoMojo
Thanks, I tried the commands from CLI and they worked, however I put them into my .bash_profile and nothing happens when I log on.
Is it called "run_client"? If so, is run_client a binary?
Don't type "echo $PATH run_client &". Only type "echo $PATH" to see what directories are currently in your path. It is used for information only.
If "run_client" is a binary and if it is in your path then you will only need to type "run_client" without the quotes. If "run_client" is in a directory that is not currently in your path then you need to put the directory (not the program) in your path. For example, if "run_client" is in the /usr/bin directory then you would do "export PATH=$PATH:/usr/bin". After that you will be able to type "run_client" and the program will run.
Another way to determine whether "run_client" is in your path is to type "which run_client" without the quotes. If it is in your path it will show you the directory it is in. If it's not in your path it will say something like "no run_client found in this directory, that directory or that other directory".
If you know exactly where "run_client" is, can you type "file /path/to/run_client" and then post back here what it says?
the program is called run_client
dont know how to tell if its a binary, but all i have to do to run it is cd to its directory, and type "run_client &" and it will un for me in the background.
I did use the command export PATH=$PATH:/usr/BOINC
which is the path I need. When I do that it does allow me to run run_client from my home directory without having to cd to the programs directory.
however once I logoff that directory is gone from my home path.
the program is called run_client
dont know how to tell if its a binary, but all i have to do to run it is cd to its directory, and type "run_client &" and it will un for me in the background.
I did use the command export PATH=$PATH:/usr/BOINC
which is the path I need. When I do that it does allow me to run run_client from my home directory without having to cd to the programs directory.
however once I logoff that directory is gone from my home path.
with regards to file /usr/BOINC/run_client I get this result...
/usr/BOINC/run_client: ASCII text
It's a text file and it runs when you type run_client & ?
Must be a script, I guess. Still, it should say something like "Bourne again script, executable".
Anyway, if you want it to stay in your path after you log out and in then you should do this:
1. Go to your home directory and type "touch .bashrc" without the quotes.
2. Open .bashrc with your favorite editor and type the following:
# .bashrc
# myExports
export PATH=$PATH:/usr/BOINC
Then save the file. From then on every time you log in and open your xterm "run_client" will be in your path. If you ever decide to take it out of your path, for whatever reason, just comment it out by typing a "#" at the beginning of the "export" line.
One thing though...be sure that your .bash_profile says:
Quote:
if [ ! "$BASHRC" -a -f ~/.bashrc ]; then
. ~/.bashrc
fi
If it doesn't then put that in the .bash_profile file exactly as quoted.
didnt work. input exactly as you have it, in both files.
is it possible that when I log in from the CLI (runlevel 3) that its not even looking for .bash_profile ???
I thought I read somewhere that .bash_profile was for logging in with a GUI.
From O'Reilly's 'Learning the Bash Shell', 3rd edition (pg 57):
.bash_profile is read and executed only by the login shell. If you start up a new shell (a subshell) by typing bash on the command line, it will attempt to read commands from the file .bashrc.
In other words, .bash_profile is run when you login at the CLI in run level 3.
how do I know if its reading it or not??
should I not get error messages for wrong paths ro anything I am doing wrong.
I have since set it up to run when I boot, by adding some script to the rc.local file.
It took a few boot attempts before I got the scipt right. However everytime I got it wrong I was able to see boot errors telling me either the path didnt exist, or couldnt find the command etc...
Should i not see errors via the login methdod like i do with the boot method???
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.