25-03-2025
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
|
||||
|
||||
##### Sous Linux:
|
||||
|
||||
```bash
|
||||
bruno@debian:~$ sudo fdisk -l
|
||||
|
||||
@@ -18,8 +20,6 @@ Périphérique Amorçage Début Fin Secteurs Taille Id Type
|
||||
/dev/sdg2 98304 62333951 62235648 29,7G 83 Linux
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
bruno@debian:~$ sudo dd if=/dev/sdg of=~/raspian_backup.img status=progress
|
||||
62333952+0 enregistrements lus
|
||||
@@ -31,6 +31,26 @@ bruno@debian:~$ sudo dd if=/dev/sdg of=~/raspian_backup.img status=progress
|
||||
# status=progress sinon dd n'affiche rien
|
||||
```
|
||||
|
||||
##### Sur Mac:
|
||||
|
||||
```bash
|
||||
$ diskutil list
|
||||
|
||||
/dev/disk6 (external, physical):
|
||||
#: TYPE NAME SIZE IDENTIFIER
|
||||
0: FDisk_partition_scheme *8.0 GB disk6
|
||||
1: Windows_FAT_32 NO NAME 134.2 MB disk6s1
|
||||
2: Linux 7.9 GB disk6s2
|
||||
```
|
||||
|
||||
```bash
|
||||
$ sudo dd if=/dev/disk6 of=/Volumes/Sophie/RaspberryPi/DietPi_RPi1-ARMv6.dmg
|
||||
|
||||
15712256+0 records in
|
||||
15712256+0 records out
|
||||
8044675072 bytes (8,0 GB, 7,5 GiB) copied, 143,074 s, 56,2 MB/s
|
||||
```
|
||||
|
||||
|
||||
|
||||
Avec dd, l'image à la même taille que le disque, quelque soit la taille occupée réelle.
|
||||
@@ -88,6 +108,11 @@ Utiliser WinDisk32 sourceforge.net/projects/win32diskimager
|
||||
|
||||
# Sous macOS
|
||||
|
||||
ApplePi-Baker permet de sauvegarder un carte SD en fichier image, et surtout de shrinker l'image (contracter une SD de 32Go en l'espace réellement utilisésolus)
|
||||
ApplePi-Baker permet de sauvegarder un carte SD en fichier image, et surtout de shrinker l'image (contracter une SD de 32Go en l'espace réellement utilisé)
|
||||
|
||||
[ApplePi-Baker v2](https://www.tweaking4all.com/software/macosx-software/applepi-baker-v2/)
|
||||
|
||||
```bash
|
||||
brew install applepi-baker
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user