Operating System - HP-UX
1837609 Members
3261 Online
110117 Solutions
New Discussion

execute command automatically on login

 
SOLVED
Go to solution
Carles Viaplana
Valued Contributor

execute command automatically on login

Hello,

I need an account executes automatically a command every time user login to system.

How can I do it?

Thanks in advance for your help.
Regards,

Carles
5 REPLIES 5
Arunvijai_4
Honored Contributor
Solution

Re: execute command automatically on login

Hi Carles,

Easy Q, you can just append the command in that particular user's profile /home/$user/.profile

-Arun

"A ship in the harbor is safe, but that is not what ships are built for"
Bharat Katkar
Honored Contributor

Re: execute command automatically on login

Hi Carles,
You can edit users .profile file and add a command to it.

$HOME/.profile

Regards,
You need to know a lot to actually know how little you know
Muthukumar_5
Honored Contributor

Re: execute command automatically on login

You can put it in $HOME of the user and create .profile file and put the command to be executed.

-- $HOME/.profile ---

hostname
clear
echo "ok"

It will execute those commands. change to your command.

-Muthu

Easy to suggest when don't know about the problem!
Jayasuntar
Valued Contributor

Re: execute command automatically on login

Dear Carles,

Deponds on the shell the account uses to login, you need to put your commands on the users .profile or .login or .dtprofile.

All the best.
Jay
Carles Viaplana
Valued Contributor

Re: execute command automatically on login

Thanks to all for your help!
Regards,

Carles