Re: Strange periodic problem

classic Classic list List threaded Threaded
5 messages Options
zep
Reply | Threaded
Open this post in threaded view
|

Re: Strange periodic problem

zep
On 10/23/2017 10:51 PM, Paul Schmehl wrote:
> I wrote a script to do database backups. It worked well, so I copied
> it to another server. I had to alter it, because the db was too big to
> send through email, so it creates the backup, removes the previous
> days and then sends email to me notifying me that it ran. Except, it
> doesn't work.
>
> And I have no idea why.

what does your /etc/crontab file look like?  how does it compare
between the two machines?

>
> The periodic script is executable.
> # ls -lsa /etc/periodic/daily/220.dbbackup
> 2 -rwxr-xr-x  1 root  wheel  37 Oct 19 12:31
> /etc/periodic/daily/220.dbbackup
>
> The script calls sh to run the actual script.
> # cat /etc/periodic/daily/220.dbbackup
> #!/bin/sh
> /usr/local/bin/dbbackup.sh
>  

do you get anything more useful if you change the line to sh -x to
call the .sh file?  is it possible there are some weird control
characters in any of those files?  e.g. do they still look the
same if you cat -v them?

> Periodic.conf enables the script.
> # grep dbbackup /etc/periodic.conf
> daily_dbbackup_enable="YES"
>
> The script itself is executable.
> # ls -lsa /usr/local/bin/dbbackup.sh
> 2 -rwxr-xr-x  1 root  wheel  446 Oct 11 23:40 /usr/local/bin/dbbackup.sh
>
> The script runs manually, and I get the email.
> # /usr/local/bin/dbbackup.sh
> rm: /usr/home/pauls/102217.alldb.sql: No such file or directory
>
> (The previous backup doesn't exist, because the script isn't running
> daily.)
>
> What have I missed?
>
> Paul Schmehl, Retired
>
>

what version of freebsd did it first run on?  what's the version of the
new machine (or more importantly, are they at the same versions?)


_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Strange periodic problem

Paul Schmehl
--On October 24, 2017 at 12:22:06 AM -0400 zep <[hidden email]>
wrote:

> On 10/23/2017 10:51 PM, Paul Schmehl wrote:
>> I wrote a script to do database backups. It worked well, so I copied
>> it to another server. I had to alter it, because the db was too big to
>> send through email, so it creates the backup, removes the previous
>> days and then sends email to me notifying me that it ran. Except, it
>> doesn't work.
>>
>> And I have no idea why.
>
> what does your /etc/crontab file look like?  how does it compare
> between the two machines?

A diff shows they are identical.

>>
>> The periodic script is executable.
>> # ls -lsa /etc/periodic/daily/220.dbbackup
>> 2 -rwxr-xr-x  1 root  wheel  37 Oct 19 12:31
>> /etc/periodic/daily/220.dbbackup
>>
>> The script calls sh to run the actual script.
>> # cat /etc/periodic/daily/220.dbbackup
>> # !/bin/sh
>> /usr/local/bin/dbbackup.sh
>>  
>
> do you get anything more useful if you change the line to sh -x to
> call the .sh file?  is it possible there are some weird control
> characters in any of those files?  e.g. do they still look the
> same if you cat -v them?
>

Well, they're not the same. They're quite similar, but not the same. In
answering Adam's question, I now realize that NONE of the periodic scripts
are running.

>> Periodic.conf enables the script.
>> # grep dbbackup /etc/periodic.conf
>> daily_dbbackup_enable="YES"
>>
>> The script itself is executable.
>> # ls -lsa /usr/local/bin/dbbackup.sh
>> 2 -rwxr-xr-x  1 root  wheel  446 Oct 11 23:40
>> /usr/local/bin/dbbackup.sh
>>
>> The script runs manually, and I get the email.
>> # /usr/local/bin/dbbackup.sh
>> rm: /usr/home/pauls/102217.alldb.sql: No such file or directory
>>
>> (The previous backup doesn't exist, because the script isn't running
>> daily.)
>>
>> What have I missed?
>>
>> Paul Schmehl, Retired
>>
>>
>
> what version of freebsd did it first run on?  what's the version of the
> new machine (or more importantly, are they at the same versions?)
>
Both machines are running FreeBSD 10.3-RELEASE.

>
> _______________________________________________
> [hidden email] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "[hidden email]"



Paul Schmehl, Retired
As if it wasn't already obvious, my opinions
are my own and not those of my employer.
*******************************************
"It is as useless to argue with those who have
renounced the use of reason as to administer
medication to the dead." Thomas Jefferson
"There are some ideas so wrong that only a very
intelligent person could believe in them." George Orwell

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Strange periodic problem

Adam Vande More
In reply to this post by zep
On Tue, Oct 24, 2017 at 12:10 AM, Paul Schmehl <[hidden email]>
wrote:

> No. But that was a really good question, because now that I look at it
> *none* of the periodic scripts are running. Strange.
>

# /etc/rc.d/cron restart
# /etc/rc.d/cron status

Ensure it is running.  Most likely it would log something to
/var/log/messages about the attempt.

Another option is to start cron in the foreground and examine it's output.

--
Adam
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Strange periodic problem

Paul Schmehl


--On October 24, 2017 at 8:18:35 AM -0500 Adam Vande More
<[hidden email]> wrote:

> On Tue, Oct 24, 2017 at 12:10 AM, Paul Schmehl <[hidden email]>
> wrote:
>
>> No. But that was a really good question, because now that I look at it
>> *none* of the periodic scripts are running. Strange.
>>
>
># /etc/rc.d/cron restart
># /etc/rc.d/cron status
>
> Ensure it is running.  Most likely it would log something to
> /var/log/messages about the attempt.
>
> Another option is to start cron in the foreground and examine it's output.

Cron is running. I added -x sch to see what it would log.

After further analysis, the jobs are running fine. (For example, the db
backup that started this thread is running find, backing up every day.)
I'm not getting the email. I used to get emails daily with the periodic
jobs, but those are no longer coming. I didn't notice they had stopped,
because I get so much email it's easy to miss (and most of it is
inconsequential anyway. Hundreds of breakin attempts to ssh, and that sort
of thing.

Still investigating. There's nothing of any consequence in
/var/log/messages, and /var/log/cron apparently doesn't log periodic jobs.
I'm hoping setting the debug flag will reveal more information.


Paul Schmehl, Retired
As if it wasn't already obvious, my opinions
are my own and not those of my employer.
*******************************************
"It is as useless to argue with those who have
renounced the use of reason as to administer
medication to the dead." Thomas Jefferson
"There are some ideas so wrong that only a very
intelligent person could believe in them." George Orwell

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Strange periodic problem

Paul Schmehl
In reply to this post by Adam Vande More
--On October 24, 2017 at 8:18:35 AM -0500 Adam Vande More
<[hidden email]> wrote:

> On Tue, Oct 24, 2017 at 12:10 AM, Paul Schmehl <[hidden email]>
> wrote:
>
>> No. But that was a really good question, because now that I look at it
>> *none* of the periodic scripts are running. Strange.
>>
>
># /etc/rc.d/cron restart
># /etc/rc.d/cron status
>
> Ensure it is running.  Most likely it would log something to
> /var/log/messages about the attempt.
>
> Another option is to start cron in the foreground and examine it's output.

I take that back. After going through the cron log one line at a time, I
found this: Oct 26 03:01:00 server1 /usr/sbin/cron[89536]: (root) CMD
(periodic daily)

I was expecting to see the names of the individual scripts.

So, periodic jobs are being logged, and cron is running fine. It's just not
sending email any more.

Paul Schmehl, Retired
As if it wasn't already obvious, my opinions
are my own and not those of my employer.
*******************************************
"It is as useless to argue with those who have
renounced the use of reason as to administer
medication to the dead." Thomas Jefferson
"There are some ideas so wrong that only a very
intelligent person could believe in them." George Orwell

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[hidden email]"