public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] crontab backup
@ 2014-09-17  1:30 Joseph
  2014-09-17  2:22 ` [gentoo-user] " Jouni Kosonen
  2014-09-17  8:43 ` [gentoo-user] " Neil Bothwick
  0 siblings, 2 replies; 4+ messages in thread
From: Joseph @ 2014-09-17  1:30 UTC (permalink / raw
  To: gentoo-user

I'm trying to backup crontab from various boxes to files, so I'm using (run once a month)
11 01 * * 5 crontab -l > /home/joseph/business/backup/crontabs/syscon7_joseph_crontab

but I can from bash: cannot overwrite existing file

-- 
Joseph


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-user] Re: crontab backup
  2014-09-17  1:30 [gentoo-user] crontab backup Joseph
@ 2014-09-17  2:22 ` Jouni Kosonen
  2014-09-17  2:57   ` Joseph
  2014-09-17  8:43 ` [gentoo-user] " Neil Bothwick
  1 sibling, 1 reply; 4+ messages in thread
From: Jouni Kosonen @ 2014-09-17  2:22 UTC (permalink / raw
  To: gentoo-user

Joseph wrote:

> I'm trying to backup crontab from various boxes to files, so I'm using
> (run once a month) 11 01 * * 5 crontab -l >
> /home/joseph/business/backup/crontabs/syscon7_joseph_crontab
> 
> but I can from bash: cannot overwrite existing file
> 

From "man bash":

   Redirecting Output
...
       If the redirection operator is >, and the noclobber option  to  the
       set builtin has been enabled, the redirection will fail if the file
       whose name results from the expansion of word exists and is a regu‐
       lar  file.   If  the redirection operator is >|, or the redirection
       operator is > and the noclobber option to the set  builtin  command
       is not enabled, the redirection is attempted even if the file named
       by word exists.


---
Jouni





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] Re: crontab backup
  2014-09-17  2:22 ` [gentoo-user] " Jouni Kosonen
@ 2014-09-17  2:57   ` Joseph
  0 siblings, 0 replies; 4+ messages in thread
From: Joseph @ 2014-09-17  2:57 UTC (permalink / raw
  To: gentoo-user

On 09/17/14 05:22, Jouni Kosonen wrote:
>Joseph wrote:
>
>> I'm trying to backup crontab from various boxes to files, so I'm using
>> (run once a month) 11 01 * * 5 crontab -l >
>> /home/joseph/business/backup/crontabs/syscon7_joseph_crontab
>>
>> but I can from bash: cannot overwrite existing file
>>
>
>From "man bash":
>
>   Redirecting Output
>...
>       If the redirection operator is >, and the noclobber option  to  the
>       set builtin has been enabled, the redirection will fail if the file
>       whose name results from the expansion of word exists and is a regu‐
>       lar  file.   If  the redirection operator is >|, or the redirection
>       operator is > and the noclobber option to the set  builtin  command
>       is not enabled, the redirection is attempted even if the file named
>       by word exists.

Yes, that worked. Thanks

-- 
Joseph


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] crontab backup
  2014-09-17  1:30 [gentoo-user] crontab backup Joseph
  2014-09-17  2:22 ` [gentoo-user] " Jouni Kosonen
@ 2014-09-17  8:43 ` Neil Bothwick
  1 sibling, 0 replies; 4+ messages in thread
From: Neil Bothwick @ 2014-09-17  8:43 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

On Tue, 16 Sep 2014 19:30:36 -0600, Joseph wrote:

> I'm trying to backup crontab from various boxes to files, so I'm using
> (run once a month) 11 01 * * 5 crontab -l
> > /home/joseph/business/backup/crontabs/syscon7_joseph_crontab
> 
> but I can from bash: cannot overwrite existing file

Do you have noclobber in your shell options? If so, replace > with >| to
overwrite files. Or use tee, which will happily overwrite files with no
consideration of their type, content or importance :(


-- 
Neil Bothwick

Growing old is mandatory; growing up is optional!!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-17  8:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-17  1:30 [gentoo-user] crontab backup Joseph
2014-09-17  2:22 ` [gentoo-user] " Jouni Kosonen
2014-09-17  2:57   ` Joseph
2014-09-17  8:43 ` [gentoo-user] " Neil Bothwick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox