- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell Script needed
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2003 05:59 PM
06-24-2003 05:59 PM
Shell Script needed
I need to get a UNIX shell script to "wall" to users individually every # of minutes after they logged in. Different users might login to UNIX at various times and they need to be "walled" only after # minutes after they logged in. I tried using last, w, and read
links in this forum but did not find any such scripts.
Thanks in advance.
HT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2003 06:36 PM
06-24-2003 06:36 PM
Re: Shell Script needed
I think it's difficult but there are always some ways...mmmmmm, now I get a new one even it is a little folly:
You can put the wall file to somedir, for example /tmp/wallmsg.txt.
In users' .profile, edit their cron(repeat) or at(once) schedule to "ECHO"(more or cat) /tmp/wallmsg.txt every # of minutes.
You can make each ".profile" 555 if you want!
For this way, wall is not needed!
Others?
:p
-ux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2003 06:53 PM
06-24-2003 06:53 PM
Re: Shell Script needed
sounds like a cool project.
did you know in korn shell there is a timeout variable you can set per user. this will time out idle users after preset time.
although the top has nothing to do with your request, here is my guideline as to how you should approach this project/script/daemon
1. the script must run as a daemon in order to work properly.
2. you must then build a timer inside the daemon to check for logged in users at a specific time or at every XX seconds.
3. once it reach that time, wall each of the users at their terminals whatevr you want,
4. finally go to sleep again for xx time.
5. repeat the process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2003 07:00 PM
06-24-2003 07:00 PM
Re: Shell Script needed
Use cron at 5 minute intervals to launch the script. DON'T USE sleep IN A .profile file. This will fill up your process table.
http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B9106-90007/B9106-90007_top.html&con=/hpux/onlinedocs/B9106-90007/00/01/105-con.html&toc=/hpux/onlinedocs/B9106-90007/00/01/105-toc.html&searchterms=finger&queryid=20030624-205156
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2003 07:03 PM
06-24-2003 07:03 PM
Re: Shell Script needed
anyway let start.
# we are going to use functions
mytime=$(date +%H%M%S)
# debug
echo ${mytime}
check_users(){
users=$(who -um | awk '{print $1}'
#this will record all the currenly logged in users to the variable $users
}
wall_em() {
check_users
if [ -n $users ]
then
# well, we have users - whoooo hoooo!!
# wall or banner them
wall $users
else
# hey gues what - there is no users logged in - peace on earth
:
fi
}
# now lets start the process
while true
do # daemon loop
wall_em
# when youre done
# then wait for a few seconds
sleep 900 # you don't want to piss off your users - so 15 minutes is good.
done
exit 0
# hey its that easy- let me know
liev free or die
donny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2003 07:05 PM
06-24-2003 07:05 PM
Re: Shell Script needed
How about setup a cron job in root, and get the connected user/terminal list with the "who" command, and calculate the time difference between system time and logon time, those who satisfy the conditional of logging in for more than # minutes will be written a message to their terminals one by one with:
# echo your message > /dev/tty/ta
I have a c program to calculate the difference between two date-time, see attached file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2003 07:09 PM
06-24-2003 07:09 PM
Re: Shell Script needed
if you want to do it on a per user basis. then you have to record the time they logged in.
then don't do it in their .profile - many users will delete the code.
this gets a little tricy not impossible.
let me think about it for a while - i'll get back to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2003 03:03 AM
06-26-2003 03:03 AM
Re: Shell Script needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2003 03:43 AM
06-26-2003 03:43 AM
Re: Shell Script needed
a.out `date "+%Y %m %d %H %M %S"` `date "+%Y %m %d %H %M %S"`
who or finger -q returns in the format
Jun 26 06:39 how to convert it to
"2003 06 26 06 39 ss"
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2003 03:54 AM
06-26-2003 03:54 AM
Re: Shell Script needed
note, the process will have to be a root process. I really think this should be done via the application and not a daemon. There's nothing like screwing up a users screen with messages, especially if the application doesn't have a REDRAW feature.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2003 04:48 AM
06-26-2003 04:48 AM
Re: Shell Script needed
case $MMM in
"Jan")
MM=1
;;
"Feb")
MM=2
;;
:
:
"Dec")
MM=12
;;
esac
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2003 04:04 AM
06-29-2003 04:04 AM
Re: Shell Script needed
There is a simple solution, can be applied from login startup script.
craete a script that contains:
write $LOGNAME << EOT
Your notification
EOT
At startup script enter the command
at now + # minutes script