25-03-2025

This commit is contained in:
2025-03-25 15:52:48 +01:00
parent 259b9c6a24
commit 011cfcba40
64 changed files with 2993 additions and 45 deletions

View File

@@ -42,6 +42,13 @@ systemctl status dropbear.service
DROPBEAR_EXTRA_ARGS=“-w -g”
```
Editer et redémarrer Dropbear:
```bash
root@PiHole1:~# nano /etc/default/dropbear
root@PiHole1:~# systemctl restart dropbear.service
```
#### --help
@@ -95,3 +102,75 @@ Usage: dropbear [options]
cat ~/.ssh/id_rsa.pub | ssh -p65535 root@192.168.12.116 'cat>> ~/.ssh/authorized_keys'
```
### Log
```bash
# journalctl --no-pager | grep 'cron'
```
| Command | Remark |
| :-------------------------------------------- | :----------------------------------------------------------- |
| `journalctl -u UNITNAME` (`--unit UNITNAME`) | Displays messages of the given unit |
| `journalctl _PID=<process_id>` | Displays messages of process with PID equals to <process_id> |
| `journalctl -r` (`--reverse`) | Displays list in reverse order, i.e. newest messages first |
| `journalctl -f` (`--follow`) | Displays the tail of the log message list and shows new entries *live* |
| `journalctl -b` (`--boot`) | Displays messages since the last boot (i.e. no older messages). See also option `--list-boots` |
| `journalctl -k` (`--dmesg`) | Displays kernel messages |
| `journalctl -p PRIORITY` (priority PRIORITY) | Displays messages with the given priority. PRIORITY may be `merg`, `alert`, `crit`, `err`, `warning`, `notice`, `info` and `debug`. Also numbers as PRIORITY are possible |
| `journalctl -o verbose` | Displays additional meta data |
| `journalctl --disk-usage` | Displays the amount of disk space used by the logging messages |
| `journalctl --no-pager | grep <filter>` | Filters log messages (filtering with `grep`) |
#### Quand sont exécutés les scripts cron.hourly, cron.daily, cron.montly...
```bash
grep run-parts /etc/crontab
#*/0 * * * * root cd / && run-parts --report /etc/cron.minutely
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 1 * * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
47 1 * * 7 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
52 1 1 * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }
```
#### Exécuter les scripts cron.hourly, cron.daily, cron.montly...
```bash
run-parts --test /etc/cron.hourly/
```
#### Ajouter un script à cron.hourly
```bash
root@PiHole1:/etc/cron.hourly# l
total 16
-rw-r--r-- 1 root root 102 Mar 2 2023 .placeholder
-rwxr-xr-x 1 root root 1311 Aug 27 19:49 dietpi
-rwxr-xr-x 1 root root 191 Feb 22 2012 fake-hwclock
-rwxr-xr-x 1 root root 60 Sep 5 09:47 pihole
```
```bash
nano /etc/cron.hourly/pihole
#!/bin/bash
#Look for pihole update
/root/update_pihole.sh
```
```bash
*/2 * * * * # toutes les 2 minutes
* */2 * * * # toutes les 2 heures
0 1 * * 1,3,5 # At 01:00 on Monday, Wednesday, and Friday
```