Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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'm looking for a simple script to move and archive logs created by a windows application. The application starts a new log when it reaches a certain size. I want to move all logs except the one currently being written to so they can be processed and archived. I cant suspend the windows app and move all of them so I need a reliable way to identify the one still being written and skip that one. Any ideas would be helpful
How are the logs getting onto the Linux machine? Over a Samba share, or is the program running under WINE?
Regardless, you could use logrotate to archive the logs past a certain size and prevent the log from being removed while in use. logrotate will work with any file you point it to, it doesn't specifically have to be a Linux log file.
The files are on a share on the windows machine. The windows app actually does the log rotation, when the file size gets to 100k it closes the log and starts a new one so all I really need to do is move the files once an hour or so. The only problem is I cant move the one that is currently being written to so I need some way to skip that file.
Well, certainly the filenames must be different once the log is rotated out. Whatever operations you perform (even if it is as simple as moving them to a different directory), you should just have to specify the rotated-out filename or extension.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.