Compare commits

..

5 commits

Author SHA1 Message Date
mwiegand
60d30e9df0 readme notes 2022-02-23 18:04:17 +01:00
mwiegand
2549a298a4 nextcloud picsort: faster, apperently 2022-02-23 18:04:06 +01:00
mwiegand
b52030b830 nextcloud weekly rescan 2022-02-23 18:03:38 +01:00
mwiegand
5a9716b0ff nextcloud supress pcntl error and use json 2022-02-23 18:03:05 +01:00
mwiegand
ad145c3ace fix wireguard client config 2022-02-23 17:19:34 +01:00
9 changed files with 45 additions and 15 deletions

View file

@ -7,3 +7,8 @@
- LDAP
- oauth2/OpenID
- icinga
Raspberry pi as soundcard
- gadget mode
- OTG g_audio
- https://audiosciencereview.com/forum/index.php?threads/raspberry-pi-as-usb-to-i2s-adapter.8567/post-215824

View file

@ -7,7 +7,7 @@ from ipaddress import ip_network, ip_interface
repo = Repository(dirname(dirname(realpath(__file__))))
server_node = repo.get_node(argv[2])
server_node = repo.get_node(argv[1])
data = server_node.metadata.get(f'wireguard/clients/{argv[2]}')
vpn_network = ip_interface(server_node.metadata.get('wireguard/my_ip')).network

View file

@ -2,8 +2,12 @@
USER="$1"
SOURCEPATH="/var/lib/nextcloud/$1/files/$2"
DESTINATIONPATH="/var/lib/nextcloud/$1/files/$3"
UNSORTABLEPATH="/var/lib/nextcloud/$1/files/$4"
REL_DEST_PATH="/$1/files/$3"
ABS_DEST_PATH="/var/lib/nextcloud/$1/files/$3"
REL_UNSORTABLE_PATH="/$1/files/$4"
ABS_UNSORTABLE_PATH="/var/lib/nextcloud/$1/files/$4"
echo "STARTING..."
@ -19,7 +23,7 @@ for f in `find "$SOURCEPATH" -iname *.PNG -o -iname *.JPG -o -iname *.CR2 -o -in
if ! echo "$DATE" | grep "Create Date" >/dev/null
then
RELPATH=$(realpath --relative-to="$SOURCEPATH" "$f")
DIRNAME=$(dirname "$UNSORTABLEPATH/$RELPATH")
DIRNAME=$(dirname "$ABS_UNSORTABLE_PATH/$RELPATH")
echo "UNSORTABLE: $f"
mkdir -p "$DIRNAME"
mv "$f" "$DIRNAME"
@ -39,7 +43,7 @@ for f in `find "$SOURCEPATH" -iname *.PNG -o -iname *.JPG -o -iname *.CR2 -o -in
else
RAW=""
fi
FILE="$DESTINATIONPATH/$YEAR-$MONTH/$RAW$YEAR$MONTH$DAY"-"$HOUR$MINUTE$SECOND"_"$HASH"."$EXT"
FILE="$ABS_DEST_PATH/$YEAR-$MONTH/$RAW$YEAR$MONTH$DAY"-"$HOUR$MINUTE$SECOND"_"$HASH"."$EXT"
echo "DESTINATION: $FILE"
mkdir -p "$(dirname "$FILE")"
mv -v "$f" "$FILE"
@ -49,12 +53,13 @@ done
if [ "$SCAN" == "TRUE" ]; then
echo "SCANNING..."
# find "$SOURCEPATH/"* -type d -empty -delete >> /var/echo/nc-picsort.echo # nextcloud app bug when deleting folders
chown -R www-data:www-data "$DESTINATIONPATH"
chown -R www-data:www-data "$UNSORTABLEPATH"
chmod -R 770 "$DESTINATIONPATH"
chmod -R 770 "$UNSORTABLEPATH"
sudo -u www-data php /opt/nextcloud/occ files:scan "$USER"
sudo -u www-data php /opt/nextcloud/occ preview:generate-all "$USER"
chown -R www-data:www-data "$ABS_DEST_PATH"
chown -R www-data:www-data "$ABS_UNSORTABLE_PATH"
chmod -R 770 "$ABS_DEST_PATH"
chmod -R 770 "$ABS_UNSORTABLE_PATH"
sudo -u www-data php /opt/nextcloud/occ files:scan --path "$REL_UNSORTABLE_PATH"
sudo -u www-data php /opt/nextcloud/occ files:scan --path "$REL_DEST_PATH"
sudo -u www-data php /opt/nextcloud/occ preview:pre-generate
fi
echo "FINISH."

View file

@ -0,0 +1,4 @@
#!/bin/bash
php /opt/nextcloud/occ files:scan-app-data
php /opt/nextcloud/occ preview:generate-all

View file

@ -80,6 +80,15 @@ files = {
'directory:/etc/nextcloud',
],
},
'/opt/nextcloud/rescan': {
'owner': 'www-data',
'group': 'www-data',
'mode': '550',
'needs': [
'directory:/opt/nextcloud',
'action:extract_nextcloud',
],
},
}
# SETUP
@ -97,7 +106,7 @@ actions['install_nextcloud'] = {
admin_pass=node.metadata.get('nextcloud/admin_pass'),
data_dir='/var/lib/nextcloud',
),
'unless': repo.libs.nextcloud.occ('status') + ' | grep -q "installed: true"',
'unless': repo.libs.nextcloud.occ('status', output='json') + ' | jq -r .installed | grep -q "^true$"',
'needs': [
'directory:/etc/nextcloud',
'directory:/opt/nextcloud',

View file

@ -68,8 +68,14 @@ defaults = {
},
'systemd-timers': {
'nextcloud-cron': {
'command': '/usr/bin/sudo -u www-data /usr/bin/php -f /opt/nextcloud/cron.php',
'command': '/usr/bin/php -f /opt/nextcloud/cron.php',
'when': '*:0/5',
'user': 'www-data',
},
'nextcloud-rescan': {
'command': '/opt/nextcloud/rescan',
'when': 'Sun 00:00:00',
'user': 'www-data',
},
},
'zfs': {

View file

@ -7,7 +7,6 @@ output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
serialize_precision = -1
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals
ignore_user_abort = Off
zend.enable_gc = On
expose_php = Off

View file

@ -28,6 +28,7 @@ def systemd(metadata):
'Description': f'{name} timer service',
},
'Service': {
'User': config.get('user', 'root'),
'ExecStart': config['command'],
},
},

View file

@ -6,8 +6,9 @@ defaults = {
},
'systemd-timers': {
'tasmota-charge': {
'command': f'/usr/bin/sudo -u tasmota-charge /opt/tasmota-charge',
'command': f'/opt/tasmota-charge',
'when': 'minutely',
'user': 'tasmota-charge',
},
},
}