Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I know the command "last" can show the user login record , so now when I use this command , it shows the user login record in this half year ( I didn't clear it for half year ) , can advise if I want clear the old record so that it only show the record from 1-feb-09 ( that mean clear the record before 1-feb-09 ) , what can i do ?
Find out what file that database is located in, use google. Then you could completely clear it by
echo "" > database.txt
or you could run a special script delete all the records except the ones in feb 09. Or depending on the size of the file, run
ls -l database.txt
if the size of the file is a lot less that your ram, you could just try running kedit, then open the file and edit it manually. The filename probably isnt' called database.txt, just using that as an example.
Find out what file that database is located in, use google. Then you could completely clear it by
echo "" > database.txt
or you could run a special script delete all the records except the ones in feb 09. Or depending on the size of the file, run
ls -l database.txt
if the size of the file is a lot less that your ram, you could just try running kedit, then open the file and edit it manually. The filename probably isnt' called database.txt, just using that as an example.
I find the lastlog , you mean try echo lastlog > database.txt ? I tried it but not work...
You can truncate the file wtmp using the tail command, even if it is a binary file. First do a backup of the original wtmp file somewhere. Then you can try the tail command choosing an arbitrary number of lines (e.g. 100) redirecting the output to a file. Then substitute the original wtmp with the newly created file and try the last command. You can adjust the number of lines to truncate until you reach the 1st of February as the first record in the file. Unfortunately there is no correspondence between the number of lines in the output of last and the number of line in the wtmp file, so that you have to retry until you reach the desired size.
To avoid this handy method in the future, you can setup a logrotate script to manage the wtmp file, for example by rotating it once a month.
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 3 weeks worth of backlogs, SRG 2009/4
rotate 3
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
missingok
monthly
create 0664 root utmp
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0660 root utmp
rotate 1
}
My problem is that boinc.log is not rotating but I don't see any problem in the config files. Is there something else I need to do?
It looks correct. Try to manually run logrotate (usually it runs automatically from the daily crontab):
Code:
/usr/sbin/logrotate /etc/logrotate.conf
You can try the -f option, too. According to the man page of logrotate:
Code:
-f, --force
Tells logrotate to force the rotation, even if it doesn’t think this is necessary. Sometimes
this is useful after adding new entries to logrotate, or if old log files have been removed by
hand, as the new files will be created, and logging will continue correctly.
It looks correct. Try to manually run logrotate (usually it runs automatically from the daily crontab):
Code:
/usr/sbin/logrotate /etc/logrotate.conf
You can try the -f option, too. According to the man page of logrotate:
Code:
-f, --force
Tells logrotate to force the rotation, even if it doesn’t think this is necessary. Sometimes
this is useful after adding new entries to logrotate, or if old log files have been removed by
hand, as the new files will be created, and logging will continue correctly.
Yup, just needed a kick in the butt... I ubuntuized the command (lol) to:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.