home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.linux      Getting to be as bloated as Windows!      107,822 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 106,486 of 107,822   
   Chris Elvidge to bad sector   
   Re: pushing my bash luck   
   19 Sep 24 16:35:53   
   
   From: chris@internal.net   
      
   On 19/09/2024 at 16:14, bad sector wrote:   
   > On 9/19/24 11:01, Chris Elvidge wrote:   
   >> On 19/09/2024 at 13:18, bad sector wrote:   
   >>>   
   >>> I want to devise a shutdown cron script that will make a dated rsync   
   >>> backup of any directory under a particular path that had been written   
   >>> to during the session and then shut down.   
   >>>   
   >>> The rsync command itself would look something like   
   >>>   
   >>> rsync -ahcEWXd /x/trees-planted/ /x/trees-$date (format 2024-09-24-hr-m)   
   >>>   
   >>> The part that's over my head is for the script to know what directory   
   >>> (under /x in this case) had been written to.   
   >>>   
   >>> Maybe there's a uti that already does this and I just have to invoke   
   >>> IT with args in the script?   
   >>>   
   >>>   
   >>   
   >> Try it with a local function to override the built-in command?   
   >>   
   >> shutdown() {   
   >> printf -v today '%(%Y-%m-%d_%H-%M)T'   
   >> # this will put the contents of /x/trees-planted into the directory   
   >> # /x/trees-2024-09-19_16-00   
   >> rsync -ahcEWXd /x/trees-planted/ /x/trees-$today && /sbin/shutdown   
   >> }   
   >   
   > thanks, that gives me the date to append which I don't need if doing it   
   > manually but gotta have as part of any script.   
   >   
   >   
   OK change second line to:   
   if tty -s; then read -p "Give a value: " today; else printf -v today   
   '%(%Y-%m-%d_%H-%M)T'; fi   
      
      
   --   
   Chris Elvidge, England   
   I WILL NEVER WIN AN EMMY   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca