klt Vágesz volt annó valami hasonló ondom service-ben és valami tök egyszerű kis pici hiba volt csak nem jut eszembe.
Xfire szerver készítése
mennydorges Na, hát ezt kell végignézni. Terminálból elindul a szkripttel? Ha igen, a .service fájlban van a bibi. Ha nem, akkor meg amott.
Nálam előfordul, hogy elgépelem valaminek a nevét, kihagyok betűt, vagy felcserélek véletlenül két betűt egy névben. Ez utóbbit veszem észre legnehezebben.
Service fájlban a /./ fölösleges, elég a /
A shellben viszont tényleg kell a ./, ha az aktuális könyvtárban indítasz valamit, viszont nem kell, ha teljes útvonalát adod meg, például /usr/bin/ping
.
./xfirestart.sh
-bash: ./xfirestart.sh: /bin/shM: rossz parancsértelmező: A szövegfájl foglalt
mennydorges Akkor itt az ideje, hogy a shebang-ot kijavítsd!
sh xfirestart.sh
xfirestart.sh: 2: xfirestart.sh: /opt/PFire/src/PFire.Console/dotnet: not found
Valszeg ebben van neki a nem tetszik rész:
/opt/PFire/src/PFire.Console/dotnet run
Nem értelmezi....
Ennyi a terminálban az indítás:
cd /opt/PFire/src/PFire.Console/
dotnet run
Módosítottam az sh file-t:
#!/bin/sh
/usr/bin/dotnet /opt/PFire/src/PFire.Console/dotnet run
Most erre lázad:
sh xfirestart.sh
Could not execute because the specified command or file was not found.
Possible reasons for this include:
- You misspelled a built-in dotnet command.
does not exist. to execute a .NET program, but dotnet-/opt/PFire/src/PFire.Console/PFire.Console.csproj - You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
- Szerkesztve
mennydorges
Azt írd a szkriptbe, ahogy terminálból indulna:
#!/bin/sh
cd /opt/PFire/src/PFire.Console
dotnet run
- Szerkesztve
klt
Ezt nem értem:
sh xfirestart.sh
xfirestart.sh: 2: cd: can't cd to /opt/PFire/src/PFire.Console/
Could not execute because the specified command or file was not found.
Possible reasons for this include:
- You misspelled a built-in dotnet command.
does not exist. to execute a .NET program, but dotnet-run - You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
De még hagyján ugyanazt a hibát dobja service-ben mint azelőtt.:
● xfirepfire.service - Xfire szerver
Loaded: loaded (/etc/systemd/system/xfirepfire.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2023-05-01 21:33:40 CEST; 5s ago
Process: 9619 ExecStart=/opt/xfirestart.sh (code=exited, status=203/EXEC)
Main PID: 9619 (code=exited, status=203/EXEC)
máj 01 21:33:40 panel systemd[1]: Started Xfire szerver.
máj 01 21:33:40 panel systemd[9619]: xfirepfire.service: Failed to execute command: No such file or directory
máj 01 21:33:40 panel systemd[9619]: xfirepfire.service: Failed at step EXEC spawning /opt/xfirestart.sh: No suc
máj 01 21:33:40 panel systemd[1]: xfirepfire.service: Main process exited, code=exited, status=203/EXEC
máj 01 21:33:40 panel systemd[1]: xfirepfire.service: Failed with result 'exit-code'.
Ilyen ha terminálban kézzel indítom:
root@panel:/opt/PFire/src/PFire.Console# dotnet run
[21:36:44 DBG] An 'IServiceProvider' was created for internal use by Entity Framework.
[21:36:45 DBG] No relationship from 'Friend' to 'User' has been configured by convention because there are multiple properties on one entity type {'Me', 'Them'} that could be matched with the properties on the other entity type {'FriendsOf', 'MyFriends'}. This message can be disregarded if explicit configuration has been specified in 'OnModelCreating'.
- Szerkesztve
● xfirepfire.service - Xfire szerver
Loaded: loaded (/etc/systemd/system/xfirepfire.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2023-05-01 21:40:11 CEST; 1s ago
Process: 10834 ExecStart=/opt/xfirestart.sh (code=exited, status=203/EXEC)
Main PID: 10834 (code=exited, status=203/EXEC)
máj 01 21:40:11 panel systemd[1]: Started Xfire szerver.
máj 01 21:40:11 panel systemd[1]: xfirepfire.service: Main process exited, code=exited, status=203/EXEC
máj 01 21:40:11 panel systemd[1]: xfirepfire.service: Failed with result 'exit-code'.
sh file kézzel futtatva:
Couldn't find a project to run. Ensure a project exists in /opt, or pass the path to the project using --project.
mennydorges can't cd to /opt/PFire/src/PFire.Console/
Nem tud odamenni? Azt látom, hogy root-ként próbáltad eddig. Ezt is root-ként próbálod?
- Szerkesztve
igen tehát ssh-ba root belépés cd mappa és dotnet run és megy...
mennydorges
/opt/Pfire/src/Pfire.Console
versus:
/opt/PFire/src/PFire.Console/
Melyik az igazi?
/opt/PFire/src/PFire.Console/
Akkor nyilván a szkriptbe is az igazit kell írni
Én csak kopi-pasztáztam, szóval mosom kezeimet...
- Szerkesztve
klt de hogy is nehogy félre érts. Nem mondok ilyet. Este van majd holnap tuszta fejjel átnézem de már a kislány kezdi félórája az esti rinyát... hajnalig nem kell aludni tőle. Jó éjt és köszönöm szépen.
klt
Na picit előre.:
Bemásoltam az sh file-t a
/opt/PFire/src/PFire.Console/ -ba ott ha így meghívom:
sh xfirestart.sh
Szépen elindul.
De service-ben még mindig nem akarja....
mennydorges Mindegy, hogy hol a szkript.
Próbáljunk meg valamit (ez nem a megoldás, csak egy teszt):
#!/bin/sh
pwd
cd /opt/PFire/src/PFire.Console
pwd
Ez mit ír ki, ha futtatod?
- Szerkesztve
: not foundsh: 2: xfirestart.sh: pwd
xfirestart.sh: 3: cd: can't cd to /
De ez vicc hallod.. komolyan.
sudo chmod o+x bedobtam ezt is neki és ugyanaz.
mennydorges A pwd nincs a path-ban???
Fura...
Akkor így:
#!/bin/sh
/usr/bin/pwd
cd /opt/PFire/src/PFire.Console
/usr/bin/pwd