Hi,
I was just wondering if anyone could help i've to use the date and who command to create a single crontab job that appends a timestamp and a list of logged in users to a log file /root/hawk.
I'm not sure how to do this.
Any help would be gratefully appreciated.
Thanks
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
crontab Help
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: crontab Help
This seems to yield some results :
use the date and who command to create a single crontab job that appends a timestamp and a list of logged in users to a log file
In fact , the first hit is almost identical to the question posted here :
https://unix.stackexchange.com/question ... file-lines
The 'last' command includes a date/time stamp,
But if you must use the 'who' command, well :
So you use :
================
==============
==============
Combined with read some of the results in a search, .... you should be able to find something.
use the date and who command to create a single crontab job that appends a timestamp and a list of logged in users to a log file
In fact , the first hit is almost identical to the question posted here :
https://unix.stackexchange.com/question ... file-lines
The 'last' command includes a date/time stamp,
Code: Select all
man last
Code: Select all
$ last
garry ttyC0 Thu Nov 30 08:05 still logged in
reboot ~ Thu Nov 30 08:03
shutdown ~ Wed Nov 29 23:52
garry ttyC0 Wed Nov 29 08:00 - shutdown (15:51)
------ snip ---------
garry ttyC0 Sun Nov 19 03:58 - shutdown (16:17)
reboot ~ Sun Nov 19 03:57
shutdown ~ Sat Nov 18 19:49
Code: Select all
$ who
garry ttyC0 Nov 30 08:05
Code: Select all
man crontab
Code: Select all
man date
Code: Select all
man who
Code: Select all
man last
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: crontab Help
No, you are not wrong, it is good to try to get the OP to do a little bit of searches, Was I wrong to suggest using the keywords ? " use the date and who command to create a single crontab job that appends a timestamp and a list of logged in users to a log file", and it was kind of a surprise to see the first hit was another post with almost the same question, ... the OP still needs to
try to take the information and use it to suit their need.
Maybe it is me that was wrong ?
To be honest, if it was me, I wouldn't even bother with using crontab and the 'who' command,... I use the 'last' command, and it shows all the users that have logged in and the date, and if one wanted they could have it print the output
to any path they choose:
example:
Or, using 'who' :
That could be put into a crontab script,.... all the OP needs now is to just
read the manuals a little, and figure out how to put the pieces together into
something they can use.
====
Well,, maybe on this :
sense it is all "free handouts", nobody pays any body, we are all volunteers,
those that choose to give a answer, advice, or suggestion are free to do so,
like wise, those that don't want to give any suggestion or ideas,or answer are free to not do so. But then again , maybe I am wrong, it certainly would not be the first time I am wrong,....
Someone else might even be able to simply post a script that does exactly what the OP s looking for, but I don't think that would help the OP learn anything, beyond copy/paste a script, but in any event, if some one did that,
they are free to do so, as long as they don't try to charge the OP a fee $$$,
try to take the information and use it to suit their need.
Maybe it is me that was wrong ?
To be honest, if it was me, I wouldn't even bother with using crontab and the 'who' command,... I use the 'last' command, and it shows all the users that have logged in and the date, and if one wanted they could have it print the output
to any path they choose:
example:
Code: Select all
last > /home/garry/last-log.txt
Code: Select all
who > /home/garry/loggedin.txt
read the manuals a little, and figure out how to put the pieces together into
something they can use.
====
Well,, maybe on this :
No body charges any one for the advise, or comments they make, in thatThere are no free handouts here.
sense it is all "free handouts", nobody pays any body, we are all volunteers,
those that choose to give a answer, advice, or suggestion are free to do so,
like wise, those that don't want to give any suggestion or ideas,or answer are free to not do so. But then again , maybe I am wrong, it certainly would not be the first time I am wrong,....
Someone else might even be able to simply post a script that does exactly what the OP s looking for, but I don't think that would help the OP learn anything, beyond copy/paste a script, but in any event, if some one did that,
they are free to do so, as long as they don't try to charge the OP a fee $$$,
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: crontab Help
Thanks for taking the time to reply and offer some help, it is much appreciated.
I did search for information but wasn't sure if what I found was what I needed, but the information above is helpful.
Thanks again
I did search for information but wasn't sure if what I found was what I needed, but the information above is helpful.
Thanks again