Outils pour utilisateurs

Outils du site


welcome:ubuntu:small_tricks

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
welcome:ubuntu:small_tricks [2022/11/26 20:03]
arnaud
welcome:ubuntu:small_tricks [2023/01/08 15:11] (Version actuelle)
arnaud [Attendre la fin du script]
Ligne 1: Ligne 1:
 <color #22b14c>**Small tricks for Ubuntu**</color>  <color #22b14c>**Small tricks for Ubuntu**</color> 
  
 +====== Add a network interface (Ubuntu22) by CLI ======
 +  * list the interfaces <code># ip link show</code>
 +  * activate the interface <code># ifconfig ens19 up</code>
 +  * set the IP of the interface: <code># nano /etc/netplan/00-installer-config.yaml</code> and add the interface name and the settings
 +  * apply the settings:<code># netplan apply</code>
 ====== Auto-connect VPN and Wifi ====== ====== Auto-connect VPN and Wifi ======
 <note>runs on Ubuntu18 LXDE</note> <note>runs on Ubuntu18 LXDE</note>
Ligne 17: Ligne 22:
 [SeatDefaults] [SeatDefaults]
 session-setup-script=/etc/lightdm/lightdm.conf.d/restart-NM.sh </code> session-setup-script=/etc/lightdm/lightdm.conf.d/restart-NM.sh </code>
 +
 +====== Beep ======
 +Pour activer le "beep":
 +  * <code># apt-get install beep</code>
 +  * tester si le beep fonctionne: <code>$ sudo modprobe pcspkr     // ce réglage ne supportera pas un reboot!!
 +$ beep</code>
 +  * Rendre persistant: <code>$ sudo nano /etc/modprobe.d/blacklist.conf
 +....</code> et commenter la ligne ''blacklist pcspkr''
  
  
Ligne 49: Ligne 62:
 #!/bin/bash #!/bin/bash
  
-/usr/sbin/etherwake -i enp34s0 70:71:BC:AD:4E:F2</code>+/usr/sbin/etherwake -i enp34s0 00:11:22:33:44:55</code> 
 +<code> 
 +$ sudo cat /etc/systemd/system/wol-omv.service  
 +[Unit] 
 +After=network-online.target 
 +Wants=network-online.target 
 + 
 +[Service] 
 +ExecStart=/usr/local/bin/wol-omv.sh 
 + 
 +[Install] 
 +WantedBy=default.target 
 +</code> 
 +<code># chmod 744 /usr/local/bin/wol-omv.sh 
 +# chmod 664 /etc/systemd/system/wol-omv.service 
 +</code> 
 +<code>sudo systemctl daemon-reload 
 +# systemctl enable wol-omv.service</code> 
 + 
 +===== Attendre la fin du script ===== 
 +<note important>Ceci est un brouillon!</note> 
 +https://unix.stackexchange.com/questions/599372/kill-systemd-oneshot-service-after-timeout \\ 
 +https://trstringer.com/simple-vs-oneshot-systemd-service/ \\ 
 +https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/ 
 + 
 +<code> 
 +$ sudo cat /etc/systemd/system/le-service.service  
 +[Unit] 
 +After=network-online.target 
 +Wants=network-online.target 
 + 
 +[Service] 
 +Type=oneshot 
 +TimeoutStartSec=10s 
 +ExecStart=/usr/local/bin/le-script.sh 
 + 
 +[Install] 
 +WantedBy=default.target 
 +</code> 
 +Il faut un "TimeoutStartSec" et non un "TimeoutStopSec" car "Behavior of oneshot is similar to simple; however, the service manager will consider the unit started after the main process exits."
  
 ====== Terminal ====== ====== Terminal ======
welcome/ubuntu/small_tricks.1669492988.txt.gz · Dernière modification: 2022/11/26 20:03 de arnaud

DokuWiki Appliance - Powered by TurnKey Linux