Δημοσιεύτηκε: 14 Ιαν 2020, 18:47
Σε 18.04 δεν υπάρχει το αρχείο rc.local
Η αναζήτηση άρχισε από Εδω
Συνέχεια Εδω
Εδω οι διαφορες με 16.10
Δημιουργία αρχείου rc.local με περιεχόμενο [#!/bin/bash' 'exit 0]
Το rc.local γίνεται εκτελέσιμο.
Εδώ χοντρικά μας λέει ότι λειτουργεί όπως πρέπει
Create a service: Δημιουργία διεργασίας
Το δικό μου rc-local.service
Δημιουργία και έλεγχος να είναι εκτελέσιμο το rc.local Έγινε ποιο πάνω συνεχίζουμε ..
Enable the service: Ενεργοποίηση της (υπηρεσίας-διεργασίας)
Start service and check status: Εκκίνηση (υπηρεσίας-διεργασίας) και έλεγχος κατάστασης.
Τέλος αν όλα έγιναν σωστά μπορούμε να προσθέσουμε τις εντολές μας στο etc/rc.local και να επανεκινήσουμε
Οποιαδήποτε παρατήρηση (ειδικά στην μετάφραση) καλοδεχούμενη
Off topic:
Το κείμενο αναφέρει 16.10 άλλα θέλω να πιστεύω ότι λειτουργεί και σε18.04
Θα συνεχίσω την έρευνα και αφού εγκαταστήσω Ssd σύντομα
Η αναζήτηση άρχισε από Εδω
Συνέχεια Εδω
Εδω οι διαφορες με 16.10
Δημιουργία αρχείου rc.local με περιεχόμενο [#!/bin/bash' 'exit 0]
- Κώδικας: Επιλογή όλων
printf '%s\n' '#!/bin/bash' 'exit 0' | sudo tee -a /etc/rc.local
Το rc.local γίνεται εκτελέσιμο.
- Κώδικας: Επιλογή όλων
sudo chmod +x /etc/rc.local
- Κώδικας: Επιλογή όλων
sudo reboot
- Κώδικας: Επιλογή όλων
sudo systemctl edit --full rc-local
You can see that the head comment contains lines such as:
# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
This indicates, that in this system, if there is a file called /etc/rc.local which is executable, then it will be pulled into multi-user.target automatically. So you just create the according file (sudo touch...) and make it executable (sudo chmod +x ...).
Εδώ χοντρικά μας λέει ότι λειτουργεί όπως πρέπει
Create a service: Δημιουργία διεργασίας
- Κώδικας: Επιλογή όλων
sudo vi /etc/systemd/system/rc-local.service
Add your code there:
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
Το δικό μου rc-local.service
SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no
Create and make sure /etc/rc.local is executable and add this code inside it:
- Κώδικας: Επιλογή όλων
sudo chmod +x /etc/rc.local
Δημιουργία και έλεγχος να είναι εκτελέσιμο το rc.local Έγινε ποιο πάνω συνεχίζουμε ..
Enable the service: Ενεργοποίηση της (υπηρεσίας-διεργασίας)
- Κώδικας: Επιλογή όλων
sudo systemctl enable rc-local
Start service and check status: Εκκίνηση (υπηρεσίας-διεργασίας) και έλεγχος κατάστασης.
- Κώδικας: Επιλογή όλων
sudo systemctl start rc-local.service
- Κώδικας: Επιλογή όλων
sudo systemctl status rc-local.service
If all goes well you can add your code to the /etc/rc.local file then restart it.
Τέλος αν όλα έγιναν σωστά μπορούμε να προσθέσουμε τις εντολές μας στο etc/rc.local και να επανεκινήσουμε
Οποιαδήποτε παρατήρηση (ειδικά στην μετάφραση) καλοδεχούμενη
Off topic:
Το κείμενο αναφέρει 16.10 άλλα θέλω να πιστεύω ότι λειτουργεί και σε18.04
Θα συνεχίσω την έρευνα και αφού εγκαταστήσω Ssd σύντομα