How do I convert an upstart job to a systemd service?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have the following upstart job:
# hwclock - adjust system clock and timezone
#
# The hwclock task adjusts the system clock when the hardware clock is
# set to localtime (e.g. when dual-booting with Windows), and also
# ensures that the system timezone is set so that timestamps are written
# to FAT devices.
description "adjust system clock and timezone"
start on starting mountall
task
script
exec hwclock --systz --utc --noadjfile
end script
I would like to switch this to systemd service.
How should start on starting mountall
be implemented on systemd?
I created the systemd service as below, but I do not know how to do start on starting mountall
.
[Unit]
Description=hwclock
After=
Before=
[Service]
ExecStart=/sbin/hwclock --systz --utc --noadjfile
systemd
add a comment |Â
up vote
1
down vote
favorite
I have the following upstart job:
# hwclock - adjust system clock and timezone
#
# The hwclock task adjusts the system clock when the hardware clock is
# set to localtime (e.g. when dual-booting with Windows), and also
# ensures that the system timezone is set so that timestamps are written
# to FAT devices.
description "adjust system clock and timezone"
start on starting mountall
task
script
exec hwclock --systz --utc --noadjfile
end script
I would like to switch this to systemd service.
How should start on starting mountall
be implemented on systemd?
I created the systemd service as below, but I do not know how to do start on starting mountall
.
[Unit]
Description=hwclock
After=
Before=
[Service]
ExecStart=/sbin/hwclock --systz --utc --noadjfile
systemd
I think that's where theBefore=
line comes in!
â George Udosen
Jan 22 at 5:53
It's also probablyType=oneshot
, because hwclock will exit when it's done.
â Ulrich Schwarz
Jan 22 at 6:05
Check out systemd for upstart users and perhapsAfter=local-fs.target
.
â meuh
Jan 22 at 9:37
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have the following upstart job:
# hwclock - adjust system clock and timezone
#
# The hwclock task adjusts the system clock when the hardware clock is
# set to localtime (e.g. when dual-booting with Windows), and also
# ensures that the system timezone is set so that timestamps are written
# to FAT devices.
description "adjust system clock and timezone"
start on starting mountall
task
script
exec hwclock --systz --utc --noadjfile
end script
I would like to switch this to systemd service.
How should start on starting mountall
be implemented on systemd?
I created the systemd service as below, but I do not know how to do start on starting mountall
.
[Unit]
Description=hwclock
After=
Before=
[Service]
ExecStart=/sbin/hwclock --systz --utc --noadjfile
systemd
I have the following upstart job:
# hwclock - adjust system clock and timezone
#
# The hwclock task adjusts the system clock when the hardware clock is
# set to localtime (e.g. when dual-booting with Windows), and also
# ensures that the system timezone is set so that timestamps are written
# to FAT devices.
description "adjust system clock and timezone"
start on starting mountall
task
script
exec hwclock --systz --utc --noadjfile
end script
I would like to switch this to systemd service.
How should start on starting mountall
be implemented on systemd?
I created the systemd service as below, but I do not know how to do start on starting mountall
.
[Unit]
Description=hwclock
After=
Before=
[Service]
ExecStart=/sbin/hwclock --systz --utc --noadjfile
systemd
asked Jan 22 at 5:09
DonBit
334214
334214
I think that's where theBefore=
line comes in!
â George Udosen
Jan 22 at 5:53
It's also probablyType=oneshot
, because hwclock will exit when it's done.
â Ulrich Schwarz
Jan 22 at 6:05
Check out systemd for upstart users and perhapsAfter=local-fs.target
.
â meuh
Jan 22 at 9:37
add a comment |Â
I think that's where theBefore=
line comes in!
â George Udosen
Jan 22 at 5:53
It's also probablyType=oneshot
, because hwclock will exit when it's done.
â Ulrich Schwarz
Jan 22 at 6:05
Check out systemd for upstart users and perhapsAfter=local-fs.target
.
â meuh
Jan 22 at 9:37
I think that's where the
Before=
line comes in!â George Udosen
Jan 22 at 5:53
I think that's where the
Before=
line comes in!â George Udosen
Jan 22 at 5:53
It's also probably
Type=oneshot
, because hwclock will exit when it's done.â Ulrich Schwarz
Jan 22 at 6:05
It's also probably
Type=oneshot
, because hwclock will exit when it's done.â Ulrich Schwarz
Jan 22 at 6:05
Check out systemd for upstart users and perhaps
After=local-fs.target
.â meuh
Jan 22 at 9:37
Check out systemd for upstart users and perhaps
After=local-fs.target
.â meuh
Jan 22 at 9:37
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
You will need these lines:
Requires=
After=
As stated here:
Requires=: This directive lists any units upon which this unit essentially depends. If the current unit is activated, the units listed here must successfully activate as well, else this unit will fail. These units are started in parallel with the current unit by default.
After=: The units listed in this directive will be started before starting the current unit. This does not imply a dependency relationship and one must be established through the above directives if this is required.
The structure should be:
[Unit]
Description=hwclock
Requires= # mountall most happen
After= # mountall should have started before hwclock run
[Service]
Type=oneshort
ExecStart=/sbin/hwclock --systz --utc --noadjfile
From here:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Upstart stanza | systemd unit file directive | systemd unit file section
| |
-------------------------------------------------------------------------
start on | Wants, Requires, Before, |
| After | Unit
--------------------------------------------------------------------------
Note: This is for an Ubuntu system but should be similar. See: https://www.freedesktop.org/software/systemd/man/systemd.unit.html also.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
You will need these lines:
Requires=
After=
As stated here:
Requires=: This directive lists any units upon which this unit essentially depends. If the current unit is activated, the units listed here must successfully activate as well, else this unit will fail. These units are started in parallel with the current unit by default.
After=: The units listed in this directive will be started before starting the current unit. This does not imply a dependency relationship and one must be established through the above directives if this is required.
The structure should be:
[Unit]
Description=hwclock
Requires= # mountall most happen
After= # mountall should have started before hwclock run
[Service]
Type=oneshort
ExecStart=/sbin/hwclock --systz --utc --noadjfile
From here:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Upstart stanza | systemd unit file directive | systemd unit file section
| |
-------------------------------------------------------------------------
start on | Wants, Requires, Before, |
| After | Unit
--------------------------------------------------------------------------
Note: This is for an Ubuntu system but should be similar. See: https://www.freedesktop.org/software/systemd/man/systemd.unit.html also.
add a comment |Â
up vote
1
down vote
accepted
You will need these lines:
Requires=
After=
As stated here:
Requires=: This directive lists any units upon which this unit essentially depends. If the current unit is activated, the units listed here must successfully activate as well, else this unit will fail. These units are started in parallel with the current unit by default.
After=: The units listed in this directive will be started before starting the current unit. This does not imply a dependency relationship and one must be established through the above directives if this is required.
The structure should be:
[Unit]
Description=hwclock
Requires= # mountall most happen
After= # mountall should have started before hwclock run
[Service]
Type=oneshort
ExecStart=/sbin/hwclock --systz --utc --noadjfile
From here:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Upstart stanza | systemd unit file directive | systemd unit file section
| |
-------------------------------------------------------------------------
start on | Wants, Requires, Before, |
| After | Unit
--------------------------------------------------------------------------
Note: This is for an Ubuntu system but should be similar. See: https://www.freedesktop.org/software/systemd/man/systemd.unit.html also.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
You will need these lines:
Requires=
After=
As stated here:
Requires=: This directive lists any units upon which this unit essentially depends. If the current unit is activated, the units listed here must successfully activate as well, else this unit will fail. These units are started in parallel with the current unit by default.
After=: The units listed in this directive will be started before starting the current unit. This does not imply a dependency relationship and one must be established through the above directives if this is required.
The structure should be:
[Unit]
Description=hwclock
Requires= # mountall most happen
After= # mountall should have started before hwclock run
[Service]
Type=oneshort
ExecStart=/sbin/hwclock --systz --utc --noadjfile
From here:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Upstart stanza | systemd unit file directive | systemd unit file section
| |
-------------------------------------------------------------------------
start on | Wants, Requires, Before, |
| After | Unit
--------------------------------------------------------------------------
Note: This is for an Ubuntu system but should be similar. See: https://www.freedesktop.org/software/systemd/man/systemd.unit.html also.
You will need these lines:
Requires=
After=
As stated here:
Requires=: This directive lists any units upon which this unit essentially depends. If the current unit is activated, the units listed here must successfully activate as well, else this unit will fail. These units are started in parallel with the current unit by default.
After=: The units listed in this directive will be started before starting the current unit. This does not imply a dependency relationship and one must be established through the above directives if this is required.
The structure should be:
[Unit]
Description=hwclock
Requires= # mountall most happen
After= # mountall should have started before hwclock run
[Service]
Type=oneshort
ExecStart=/sbin/hwclock --systz --utc --noadjfile
From here:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Upstart stanza | systemd unit file directive | systemd unit file section
| |
-------------------------------------------------------------------------
start on | Wants, Requires, Before, |
| After | Unit
--------------------------------------------------------------------------
Note: This is for an Ubuntu system but should be similar. See: https://www.freedesktop.org/software/systemd/man/systemd.unit.html also.
answered Jan 22 at 6:31
George Udosen
1,112318
1,112318
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f418749%2fhow-do-i-convert-an-upstart-job-to-a-systemd-service%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
I think that's where the
Before=
line comes in!â George Udosen
Jan 22 at 5:53
It's also probably
Type=oneshot
, because hwclock will exit when it's done.â Ulrich Schwarz
Jan 22 at 6:05
Check out systemd for upstart users and perhaps
After=local-fs.target
.â meuh
Jan 22 at 9:37