Re: Is amanda busy

Chris Hoogendyk <[email protected]>
Newsgroups gmane.comp.archivers.amanda.user
Message-ID <[email protected]>
I used to use a script like this before I got a second tape drive in the library for this server. 
This script ran in a cron. So if there was any output, I would get an email. The days-running 
calculation alerted me if there was a hangup and it had been running for way too long. It would 
often go over into the next day, but if it went further than that (days running 2 or greater) I 
would have to look at it and probably intervene.


    !/bin/bash
    #
    # This server can't handle multiple runs of Amanda in parallel.
    # Therefore, check to see that Amanda is not running before launching a run of Amanda.
    #                              Chris H., 2019/08/22
    #
      if ps -ef | grep amanda | grep taper > /dev/null; then
          DAYSRUNNING=`cat /usr/local/adm/backup/days-running`;
          ((DAYSRUNNING=DAYSRUNNING+1));
          echo "$DAYSRUNNING" > /usr/local/adm/backup/days-running;
          echo "";
          echo "           ===============================";
          echo "    ***    AMANDA ALREADY RUNNING – $DAYSRUNNING DAYS    ***";
          echo "           ===============================";
          echo "";
          exit 1;
      else
         su - amandabackup -c "/usr/local/sbin/amdump daily" > /dev/null;
         /usr/local/bin/amchanger daily unload > /dev/null;
         echo "0" > /usr/local/adm/backup/days-running;
         exit 0;
      fi



On 9/23/20 1:18 PM, Nathan Stratton Treadway wrote:
> On Wed, Sep 23, 2020 at 10:10:21 +0700, Olivier wrote:
>> Does it exist a command that can be used to check whether amanda is busy
>> or not?
>>
>> For example, do not launch the daily backup if the previous one is still
>> running, or do not reboot Amanda server (network stability issue) if a
>> backup is being done.
> I don't know of a straightforward Amanda-provided command to do exactly
> this.
>
> (Note that in older versions, Amanda would abort a new amdump run if an
> old run was still underway, but in v3.5 there is support for concurrent
> runs so it specifically doesn't abort automatically any more.)
>
> In general, you can look to see if /var/log/amanda/<CONFIG>/amdump
> exists.  That symlink is created when amdump starts, and renamed to
> "amdump.1" as amdump finishes, so if the "amdump" symlink still exists
> than the job is still running (... or it died without cleaning up).
>
> If you are programming a script to check for this, you might also check
> for an "amflush" symlink at the same time -- that symlink exists while
> amflush is running, and depending on your configuration you might not
> want to start a new amdump job while amflush is running, either.
>
>
> For a manual check, you can run the "amstatus' command to see the status
> of either the current in-progress run (if it shows the amdump or amflush
> file) or last-complieted run (amdump.1/amflush.1).
>
>
> 					Nathan
>
> ----------------------------------------------------------------------------
> Nathan Stratton Treadway  -  [email protected]  -  Mid-Atlantic region
> Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
>   GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
>   Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239

-- 
---------------

Chris Hoogendyk

-
    O__  ---- Systems Administrator, Retired
   c/ /'_ --- Biology & Geosciences Departments
  (*) \(*) -- 315 Morrill Science Center III
~~~~~~~~~~ - University of Massachusetts, Amherst

<[email protected]>

---------------

Erdös 4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.