LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   execute program only once during login (https://www.linuxquestions.org/questions/linux-general-1/execute-program-only-once-during-login-250411/)

tcma 11-02-2004 07:19 PM

execute program only once during login
 
I want to execute a program only once when login.

If I put the program execution in .bashrc, then it will get executed for every shell, i.e. more than once.

I put my desired program inside ~/.bash_profile but the program does not work as expected.

The ~/.bash_profile file are as follows:
# /etc/skel/.bash_profile:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bash_profile,v 1.10 2002/11/18 19:39:22 azarah Exp $

#This file is sourced by bash when you log in interactively.
[ -f ~/.bashrc ] && . ~/.bashrc

/usr/bin/amixer sset 'VIA DXS',0, 31




My desired program is to set the volume to 100%:
/usr/bin/amixer sset 'VIA DXS',0, 31

However, the volume is still very low after login so I still need to execute the program at the shell after login.

My linux is Linux version 2.6.8-gentoo-r4.

Matir 11-02-2004 07:54 PM

You only want it executed during your first login of each boot?

Tinkster 11-02-2004 08:08 PM

Looked at rc.local yet?


Cheers,
Tink

Matir 11-02-2004 08:09 PM

Accidental duplicate, sorry.

m00t00 11-02-2004 08:09 PM

put it in a boot script, not in a shell config file.

tcma 11-03-2004 08:52 AM

Gentoo Linux does not provide such a file rc.local. Instead it has an equivalent script called /etc/conf.d/local.start where you can put all your initialization stuff.
However I still need to do
/usr/bin/amixer sset 'VIA DXS',0, 31
after I login in.

cat /etc/conf.d/local.start
# /etc/conf.d/local.start:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/local.start,v 1.4 2002/11/18 19:39:22 azarah Exp $

# This is a good place to load any misc.
# programs on startup ( 1>&2 )
# this file is similar to
/usr/bin/amixer sset 'VIA DXS',0, 31

#end of file

Quote:

Originally posted by Tinkster
Looked at rc.local yet?


Cheers,
Tink


tcma 11-03-2004 08:55 AM

Which file for gentoo linux?
I tried
/etc/conf.d/local.start
but does not work.
Please see my previous post.

Quote:

Originally posted by m00t00
put it in a boot script, not in a shell config file.


All times are GMT -5. The time now is 12:14 AM.