LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 01-19-2022, 04:35 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
[SUSE] The user crontab doesn't work


Hi all,

My OS is the "SUSE Linux Enterprise Server 12 (x86_64)". I've created a user crontab as follow:

Code:
MAILTO=myname@mycom.com
01 01 * * * /usr/sbin/logrotate -l /home/se4711/insign-easy/temp/logrotate.log -s /home/se4711/insign-easy/temp/logrotate.status /home/se4711/insign-easy/conf/logrotate-insign-easy
And the '/home/se4711/insign-easy/conf/logrotate-insign-easy' looks as follow:
Code:
/home/se4711/insign-easy/logs/catalina.out
/home/se4711/insign-easy/logs/*.log
{
    compress
    dateext
    rotate 2
    daily
    missingok
    copytruncate
}
This means, everyday at 01:01 the logs under /home/se4711/insign-easy/logs/ should be zipped and rotated. But it doesn't work.

Can someone help?

Regards
 
Old 01-19-2022, 05:15 AM   #2
petelq
Member
 
Registered: Aug 2008
Location: Yorkshire
Distribution: openSUSE(Leap and Tumbleweed) and a (not so) regularly changing third and fourth
Posts: 627

Rep: Reputation: Disabled
Quote:
Originally Posted by thomas2004ch View Post
Hi all,

My OS is the "SUSE Linux Enterprise Server 12 (x86_64)". I've created a user crontab as follow:

Code:
MAILTO=myname@mycom.com
01 01 * * * /usr/sbin/logrotate -l /home/se4711/insign-easy/temp/logrotate.log -s /home/se4711/insign-easy/temp/logrotate.status /home/se4711/insign-easy/conf/logrotate-insign-easy
And the '/home/se4711/insign-easy/conf/logrotate-insign-easy' looks as follow:
Code:
/home/se4711/insign-easy/logs/catalina.out
/home/se4711/insign-easy/logs/*.log
{
    compress
    dateext
    rotate 2
    daily
    missingok
    copytruncate
}
This means, everyday at 01:01 the logs under /home/se4711/insign-easy/logs/ should be zipped and rotated. But it doesn't work.

Can someone help?

Regards
I don't use suse enterprise but I assume it has some similarities with opensuse. I'm also not sure of the wording of the rest of you command but I'm pretty certain you have to run /sbin/<executable> as root.

Last edited by petelq; 01-19-2022 at 05:16 AM.
 
Old 01-19-2022, 06:35 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by petelq View Post
I don't use suse enterprise but I assume it has some similarities with opensuse. I'm also not sure of the wording of the rest of you command but I'm pretty certain you have to run /sbin/<executable> as root.
1.
What is /sbin/<executable>? By me there the /usr/sbin/logrotate. Maybe this is because you use OpenSuse.

2.
I also try run the /usr/sbin/logrotate as root but it doesn't help.
 
Old 01-19-2022, 09:18 AM   #4
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,176

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
Your command line arguments are a bit long and it might be stopping after /usr/sbin/logrotate and ignoring the rest, so include the entire command you want crontab to run in quotes.
Code:
01 01 * * * "/usr/sbin/logrotate -l /home/se4711/insign-easy/temp/logrotate.log -s /home/se4711/insign-easy/temp/logrotate.status /home/se4711/insign-easy/conf/logrotate-insign-easy"
If that does not work, try the commands in a shell script and make sure it works. Then have cron call that script.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gdrive from crontab does'nt work , shell is ok from command line but failed from crontab sazdovskij Linux - Newbie 3 05-20-2019 12:25 PM
replaced crontab, now should get crontab back to what it was raminn Linux - Newbie 2 10-20-2008 07:15 PM
man crontab(5) vs crontab(1) Canis Polaris Linux - Newbie 2 06-04-2008 04:03 PM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 12:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration