systemd .service/.timer question (needing help)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

systemd .service/.timer question (needing help)

Trever L. Adams
I am needing a bit of help. I am converting some of my old crontab
entries to xxx.timer and xxx.service systemd files. I have the following
(the system is a backup server that can be woken by magic packets or
some amount of time before the backups run):

ExecStart=/usr/sbin/rtcwake -m mem -t $(/usr/bin/date +\%s -d 'today
23:50') > /dev/null

It yeilds:

Invalid escape sequences in line, correcting: "/usr/sbin/rtcwake -m mem
-t $(/usr/bin/date +\%s -d 'today 23:50') > /dev/null"


Is there a way to correct this easily, or am I going to have to turn
that line into a separate shell script?

Thank you.

Trever



_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]

signature.asc (890 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: systemd .service/.timer question (needing help)

Richard Shaw-6
On Thu, Jun 15, 2017 at 4:12 PM, Trever L. Adams <[hidden email]> wrote:
I am needing a bit of help. I am converting some of my old crontab
entries to xxx.timer and xxx.service systemd files. I have the following
(the system is a backup server that can be woken by magic packets or
some amount of time before the backups run):

ExecStart=/usr/sbin/rtcwake -m mem -t $(/usr/bin/date +\%s -d 'today
23:50') > /dev/null

It yeilds:

Invalid escape sequences in line, correcting: "/usr/sbin/rtcwake -m mem
-t $(/usr/bin/date +\%s -d 'today 23:50') > /dev/null"


Is there a way to correct this easily, or am I going to have to turn
that line into a separate shell script?

SystemD executes the binaries directly without a shell so you can't use shell variables and such. You could write a script or I think prepending /usr/bin/bash on the front may work. You may need to put the commands in quotes. Google should find you an example.

Thanks,
Richard 

_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: systemd .service/.timer question (needing help)

Trever L. Adams
Thank you, Richard. you answered another question I had about one. I can now fix all of my cronjobs to be .service/.timer pairs.

Trever

On 06/15/2017 03:18 PM, Richard Shaw wrote:
On Thu, Jun 15, 2017 at 4:12 PM, Trever L. Adams <[hidden email]> wrote:
I am needing a bit of help. I am converting some of my old crontab
entries to xxx.timer and xxx.service systemd files. I have the following
(the system is a backup server that can be woken by magic packets or
some amount of time before the backups run):

ExecStart=/usr/sbin/rtcwake -m mem -t $(/usr/bin/date +\%s -d 'today
23:50') > /dev/null

It yeilds:

Invalid escape sequences in line, correcting: "/usr/sbin/rtcwake -m mem
-t $(/usr/bin/date +\%s -d 'today 23:50') > /dev/null"


Is there a way to correct this easily, or am I going to have to turn
that line into a separate shell script?

SystemD executes the binaries directly without a shell so you can't use shell variables and such. You could write a script or I think prepending /usr/bin/bash on the front may work. You may need to put the commands in quotes. Google should find you an example.

Thanks,
Richard 


_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]



_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]

signature.asc (890 bytes) Download Attachment
Loading...