LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   [SUSE] The user crontab doesn't work (https://www.linuxquestions.org/questions/linux-general-1/%5Bsuse%5D-the-user-crontab-doesnt-work-4175706630/)

thomas2004ch 01-19-2022 04:35 AM

[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

petelq 01-19-2022 05:15 AM

Quote:

Originally Posted by thomas2004ch (Post 6319888)
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.

thomas2004ch 01-19-2022 06:35 AM

Quote:

Originally Posted by petelq (Post 6319896)
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.

uteck 01-19-2022 09:18 AM

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.


All times are GMT -5. The time now is 06:40 PM.