Hi,
The autostart script needs a little work, but basically it is correct.
Things that need changing:
1) You need a valid hashbang.
This: #/bin/bash should be
#!/bin/bash. The ! is missing in your example.
2) You need an ampersand (&) after the kmail and firefox 'start' command.
This: kmail should be
kmail &. Same for the firefox line.
If you do not do this, the script will wait until the started program stops before continuing. If, for example, both kmail and firefox are not running your version of the script will start kmail and wait until kmail is stopped before it checks if firefox is running.
Here's a better version of your script:
Code:
#!/bin/bash
if [ pidof -s kmail ]
then
echo "KMail is running"
else
kmail &
fi
if [ pidof -s firefox ]
then
echo "Firefox is running"
else
firefox &
fi
About the running a script during logout question: Bash (I assume you use bash) already has a file to do that:
.bash_logout
In general this file is not present, but you can create it and fill it with commands you want to execute during a logout.
This file is user specific, so you must create it for all users that need to execute something during logout.
The details can be found in the bash manpage.
Hope this clears things up a bit.