Re: Append to logfile with year-month

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Consider the ugly

ExecStart=bash -c "whatever > /var/log/root/aptCacheUsage_$(date +%%Y-%%m).log 2>&1"

or

ExecStart=bash -c "whatever | cronolog /var/log/root/aptCacheUsage_%%Y-%%m.log 2>&1"

Best
  Donald


On 8/24/23 9:48 AM, Cecil Westerhof wrote:
> In a service file I can use:
>     StandardOutput=append:/var/log/root/aptCacheUsage.log
> 
> but I want to use something like:
>     StandardOutput=append:/var/log/root/aptCacheUsage_$(date +%%Y-%%m).log
> 
> Did does not work, because this puts it in:
>     /var/log/root/aptCacheUsage_$(date +%Y-%m).log
> 
> Is there a way I can put it in:
>     /var/log/root/aptCacheUsage_2023-08.log
> 
> while it would automatically next month go into:
>    /var/log/root/aptCacheUsage_2023-09.log
> 
> I could of-course put it into:
>     /var/log/root/aptCacheUsage.log
> 
> and at the beginning of the month move it if it exists with a timed service, but I really would not like that kind of solution.
> 
> -- 
> Cecil Westerhof


-- 
Donald Buczek
buczek@xxxxxxxxxxxxx
Tel: +49 30 8413 1433



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux