문제

I want my system to display available updates when I log in.

What I did is to setup a cron job to run daily to save the output of yum list updates to a file. Now I need to find a place for a command to cat this file which is run only when I login to the Linux machine.

I'm running RedHat Enterprise Linux and bash.

I'd like solutions for both running it on every login or only on remote logins, and also for all users and for a specific user - so I can choose the best one and so that this information is here for others. Right now I most need to be for all users and only when the first login.

도움이 되었습니까?

해결책

Append the command you would like to run to the /etc/profile file. This will make it run for all users on login.

For remote logins (through SSH), you can modify the Banner parameter of the /etc/ssh/sshd_config file.

Also, modifying /etc/issue and /etc/motd might do what you're looking for as well.

As far as running a script only the first time a user logs in, this question was answered before here: Execute a particular command only for the first time in a shell

다른 팁

Put the call in the /etc/profile file. This file is run at login for all bash users.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top