Create, Start and Stop Linux Systemd Service The 2019 Stack Overflow Developer Survey Results...

How to make Illustrator type tool selection automatically adapt with text length

How to determine omitted units in a publication

Python - Fishing Simulator

Did the new image of black hole confirm the general theory of relativity?

How to support a colleague who finds meetings extremely tiring?

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

Why not take a picture of a closer black hole?

Can I visit the Trinity College (Cambridge) library and see some of their rare books

Intergalactic human space ship encounters another ship, character gets shunted off beyond known universe, reality starts collapsing

What force causes entropy to increase?

What do I do when my TA workload is more than expected?

Using dividends to reduce short term capital gains?

Working through the single responsibility principle (SRP) in Python when calls are expensive

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

How do spell lists change if the party levels up without taking a long rest?

Are spiders unable to hurt humans, especially very small spiders?

Button changing its text & action. Good or terrible?

Word for: a synonym with a positive connotation?

How many cones with angle theta can I pack into the unit sphere?

Are there continuous functions who are the same in an interval but differ in at least one other point?

60's-70's movie: home appliances revolting against the owners

Am I ethically obligated to go into work on an off day if the reason is sudden?

Why doesn't shell automatically fix "useless use of cat"?



Create, Start and Stop Linux Systemd Service



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How to get systemd “socket” unit to automatically restart? specifically dropbear.socketSystemd service start errorHow do I figure out why systemctl service “systemd-modules-load” fails?Start a systemd user service at bootHow to run init.d service under systemd without root auth (updated)CLOSED - Puzzlingly long systemd boot times, don't know where to startFailed at step EXEC spawning: No such file or directoryUnix/Linux - service unit file cannot recognize env variable set in /etc/environmentHow to use password from environment variable in linux command?Linux: How to really execute script at shutdown with systemd (not earlier!)?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Via remote ssh access I am trying to create a systemd service, if service was not created previously, create a new one if not check if the service is active and then stop it, update the service and restart it. if the service is not active then update the service and start it. I tried the following.



     - sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "mkdir -p FROM_REMOTE/ABS/inlaks-gt-cashout/ && cd FROM_REMOTE/ABS/inlaks-gt-cashout/ && [[ ! -f service.sh ]] && echo 'java -jar inlaks-gtb-cashout-service-1.1.jar' > service.sh || echo 'File already exists'"
- sshpass -p "password" scp -o stricthostkeychecking=no target/inlaks-gtb-cashout-service-1.1.jar user@ip:FROM_REMOTE/ABS/inlaks-gt-cashout/
- sshpass -p "password" scp -o stricthostkeychecking=no service/inlaks-gt-cashout.service user@ip:FROM_REMOTE/SERVICES/
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "cd /etc/systemd/system && [[ ! -f inlaks-gt-cashout.service ]] && sudo cp /home/asodad/FROM_REMOTE/SERVICES/inlaks-gt-cashout.service /etc/systemd/system/"
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "systemctl is-active --quiet inlaks-gt-cashout.service systemctl stop inlaks-gt-cashout.service"
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "cd /etc/systemd/system/ && sshpass -p 'password' sudo systemctl start inlaks-gt-cashout.service && sshpass -p 'password' sudo systemctl enable inlaks-gt-cashout.service && sshpass -p 'password' sudo systemctl daemon-reload"



I worked the first time but on subsequent trials, I keep getting




Failed to start inlaks-gt-cashout.service: Unit inlaks-gt-cashout.service not found.




I have tried removing the service and reloading the systemctl and even reset the failed units using systemctl daemon-reload and systemctl reset-failed but same result.



The blow is my .service file



        [Unit]
Description=Start Inlaks gt cash out service
After=network.target
[Service]
Type=simple
Restart=always
WorkingDirectory=/home/asodad/FROM_REMOTE/ABS/inlaks-gt-cashout
RestartSec=5
StartLimitInterval=0
User=asodad
ExecStart=/bin/bash /home/asodad/FROM_REMOTE/ABS/inlaks-gt-cashout/service.sh
[Install]
WantedBy=multi-user.target










share|improve this question









New contributor




alex davies is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    Hi, some security issues... do not write your password plane (-P ...), it is possible to read it from local and remote machine even with other users. Second does your user have the right to run systemctl is-active --quiet without sudo? In the other lines you put...

    – Hastur
    yesterday











  • without sudo it does not have the access to @Hastur

    – alex davies
    yesterday


















0















Via remote ssh access I am trying to create a systemd service, if service was not created previously, create a new one if not check if the service is active and then stop it, update the service and restart it. if the service is not active then update the service and start it. I tried the following.



     - sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "mkdir -p FROM_REMOTE/ABS/inlaks-gt-cashout/ && cd FROM_REMOTE/ABS/inlaks-gt-cashout/ && [[ ! -f service.sh ]] && echo 'java -jar inlaks-gtb-cashout-service-1.1.jar' > service.sh || echo 'File already exists'"
- sshpass -p "password" scp -o stricthostkeychecking=no target/inlaks-gtb-cashout-service-1.1.jar user@ip:FROM_REMOTE/ABS/inlaks-gt-cashout/
- sshpass -p "password" scp -o stricthostkeychecking=no service/inlaks-gt-cashout.service user@ip:FROM_REMOTE/SERVICES/
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "cd /etc/systemd/system && [[ ! -f inlaks-gt-cashout.service ]] && sudo cp /home/asodad/FROM_REMOTE/SERVICES/inlaks-gt-cashout.service /etc/systemd/system/"
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "systemctl is-active --quiet inlaks-gt-cashout.service systemctl stop inlaks-gt-cashout.service"
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "cd /etc/systemd/system/ && sshpass -p 'password' sudo systemctl start inlaks-gt-cashout.service && sshpass -p 'password' sudo systemctl enable inlaks-gt-cashout.service && sshpass -p 'password' sudo systemctl daemon-reload"



I worked the first time but on subsequent trials, I keep getting




Failed to start inlaks-gt-cashout.service: Unit inlaks-gt-cashout.service not found.




I have tried removing the service and reloading the systemctl and even reset the failed units using systemctl daemon-reload and systemctl reset-failed but same result.



The blow is my .service file



        [Unit]
Description=Start Inlaks gt cash out service
After=network.target
[Service]
Type=simple
Restart=always
WorkingDirectory=/home/asodad/FROM_REMOTE/ABS/inlaks-gt-cashout
RestartSec=5
StartLimitInterval=0
User=asodad
ExecStart=/bin/bash /home/asodad/FROM_REMOTE/ABS/inlaks-gt-cashout/service.sh
[Install]
WantedBy=multi-user.target










share|improve this question









New contributor




alex davies is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    Hi, some security issues... do not write your password plane (-P ...), it is possible to read it from local and remote machine even with other users. Second does your user have the right to run systemctl is-active --quiet without sudo? In the other lines you put...

    – Hastur
    yesterday











  • without sudo it does not have the access to @Hastur

    – alex davies
    yesterday














0












0








0








Via remote ssh access I am trying to create a systemd service, if service was not created previously, create a new one if not check if the service is active and then stop it, update the service and restart it. if the service is not active then update the service and start it. I tried the following.



     - sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "mkdir -p FROM_REMOTE/ABS/inlaks-gt-cashout/ && cd FROM_REMOTE/ABS/inlaks-gt-cashout/ && [[ ! -f service.sh ]] && echo 'java -jar inlaks-gtb-cashout-service-1.1.jar' > service.sh || echo 'File already exists'"
- sshpass -p "password" scp -o stricthostkeychecking=no target/inlaks-gtb-cashout-service-1.1.jar user@ip:FROM_REMOTE/ABS/inlaks-gt-cashout/
- sshpass -p "password" scp -o stricthostkeychecking=no service/inlaks-gt-cashout.service user@ip:FROM_REMOTE/SERVICES/
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "cd /etc/systemd/system && [[ ! -f inlaks-gt-cashout.service ]] && sudo cp /home/asodad/FROM_REMOTE/SERVICES/inlaks-gt-cashout.service /etc/systemd/system/"
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "systemctl is-active --quiet inlaks-gt-cashout.service systemctl stop inlaks-gt-cashout.service"
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "cd /etc/systemd/system/ && sshpass -p 'password' sudo systemctl start inlaks-gt-cashout.service && sshpass -p 'password' sudo systemctl enable inlaks-gt-cashout.service && sshpass -p 'password' sudo systemctl daemon-reload"



I worked the first time but on subsequent trials, I keep getting




Failed to start inlaks-gt-cashout.service: Unit inlaks-gt-cashout.service not found.




I have tried removing the service and reloading the systemctl and even reset the failed units using systemctl daemon-reload and systemctl reset-failed but same result.



The blow is my .service file



        [Unit]
Description=Start Inlaks gt cash out service
After=network.target
[Service]
Type=simple
Restart=always
WorkingDirectory=/home/asodad/FROM_REMOTE/ABS/inlaks-gt-cashout
RestartSec=5
StartLimitInterval=0
User=asodad
ExecStart=/bin/bash /home/asodad/FROM_REMOTE/ABS/inlaks-gt-cashout/service.sh
[Install]
WantedBy=multi-user.target










share|improve this question









New contributor




alex davies is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












Via remote ssh access I am trying to create a systemd service, if service was not created previously, create a new one if not check if the service is active and then stop it, update the service and restart it. if the service is not active then update the service and start it. I tried the following.



     - sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "mkdir -p FROM_REMOTE/ABS/inlaks-gt-cashout/ && cd FROM_REMOTE/ABS/inlaks-gt-cashout/ && [[ ! -f service.sh ]] && echo 'java -jar inlaks-gtb-cashout-service-1.1.jar' > service.sh || echo 'File already exists'"
- sshpass -p "password" scp -o stricthostkeychecking=no target/inlaks-gtb-cashout-service-1.1.jar user@ip:FROM_REMOTE/ABS/inlaks-gt-cashout/
- sshpass -p "password" scp -o stricthostkeychecking=no service/inlaks-gt-cashout.service user@ip:FROM_REMOTE/SERVICES/
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "cd /etc/systemd/system && [[ ! -f inlaks-gt-cashout.service ]] && sudo cp /home/asodad/FROM_REMOTE/SERVICES/inlaks-gt-cashout.service /etc/systemd/system/"
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "systemctl is-active --quiet inlaks-gt-cashout.service systemctl stop inlaks-gt-cashout.service"
- sshpass -p "password" ssh -o stricthostkeychecking=no -t -t user@ip "cd /etc/systemd/system/ && sshpass -p 'password' sudo systemctl start inlaks-gt-cashout.service && sshpass -p 'password' sudo systemctl enable inlaks-gt-cashout.service && sshpass -p 'password' sudo systemctl daemon-reload"



I worked the first time but on subsequent trials, I keep getting




Failed to start inlaks-gt-cashout.service: Unit inlaks-gt-cashout.service not found.




I have tried removing the service and reloading the systemctl and even reset the failed units using systemctl daemon-reload and systemctl reset-failed but same result.



The blow is my .service file



        [Unit]
Description=Start Inlaks gt cash out service
After=network.target
[Service]
Type=simple
Restart=always
WorkingDirectory=/home/asodad/FROM_REMOTE/ABS/inlaks-gt-cashout
RestartSec=5
StartLimitInterval=0
User=asodad
ExecStart=/bin/bash /home/asodad/FROM_REMOTE/ABS/inlaks-gt-cashout/service.sh
[Install]
WantedBy=multi-user.target







linux ssh services systemd






share|improve this question









New contributor




alex davies is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




alex davies is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday







alex davies













New contributor




alex davies is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









alex daviesalex davies

11




11




New contributor




alex davies is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





alex davies is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






alex davies is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1





    Hi, some security issues... do not write your password plane (-P ...), it is possible to read it from local and remote machine even with other users. Second does your user have the right to run systemctl is-active --quiet without sudo? In the other lines you put...

    – Hastur
    yesterday











  • without sudo it does not have the access to @Hastur

    – alex davies
    yesterday














  • 1





    Hi, some security issues... do not write your password plane (-P ...), it is possible to read it from local and remote machine even with other users. Second does your user have the right to run systemctl is-active --quiet without sudo? In the other lines you put...

    – Hastur
    yesterday











  • without sudo it does not have the access to @Hastur

    – alex davies
    yesterday








1




1





Hi, some security issues... do not write your password plane (-P ...), it is possible to read it from local and remote machine even with other users. Second does your user have the right to run systemctl is-active --quiet without sudo? In the other lines you put...

– Hastur
yesterday





Hi, some security issues... do not write your password plane (-P ...), it is possible to read it from local and remote machine even with other users. Second does your user have the right to run systemctl is-active --quiet without sudo? In the other lines you put...

– Hastur
yesterday













without sudo it does not have the access to @Hastur

– alex davies
yesterday





without sudo it does not have the access to @Hastur

– alex davies
yesterday










0






active

oldest

votes












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






alex davies is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1424194%2fcreate-start-and-stop-linux-systemd-service%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








alex davies is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















alex davies is a new contributor. Be nice, and check out our Code of Conduct.













alex davies is a new contributor. Be nice, and check out our Code of Conduct.












alex davies is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1424194%2fcreate-start-and-stop-linux-systemd-service%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...