<details>
<summary>Let us add:</summary>
```bash
while [ true ]
do
sleep 1
done
```
</details>
to see if boot stays stuck as `&` usage seems to suggest.
[Benjamin_Loison/coreutils/issues/19](https://codeberg.org/Benjamin_Loison/coreutils/issues/19) would help.
Well it is not, so maybe the permissions are to blame.
ls -l /etc/rc.local
-rwxr-xr-x 1 root root XXX XXX. XX XX:XX /etc/rc.local
is expected.
Well it is not, so maybe the permissions are to blame.
```bash
ls -l /etc/rc.local
```
```
-rwxr-xr-x 1 root root XXX XXX. XX XX:XX /etc/rc.local
```
is expected.
```bash
mktemp --suffix _etc_rc_local_stdout
```
```
/tmp/tmp.hdUio8goPt_etc_rc_local_stdout
```
However, permanent with date logs would be nice.
```bash
echo "Start of /etc/rc.local at `date`"
```
may help.
#!/bin/sh
FOLDER_NAME=etc_rc_local
su --login benjamin_loison -c "
mkdir $FOLDER_NAME/
cd $FOLDER_NAME/
log() {
# Should ensure that date is not evaluated at script reading
echo `date` \"$@\"
}
(
log Start
(
echo my_stdout_content
echo my_stderr_content >&2
)
log End
) >> stdout.txt 2>> stderr.txt
"
cat etc_rc_local/std{out,err}.txt
Output:
Start of /etc/rc.local at Tue Feb 18 02:56:46 PM CET 2025
my_stdout_content
End of /etc/rc.local at Tue Feb 18 02:56:46 PM CET 2025
my_stderr_content
After a reboot:
cat etc_rc_local/std{out,err}.txt
Output:
Start of /etc/rc.local at Tue Feb 18 02:56:46 PM CET 2025
my_stdout_content
End of /etc/rc.local at Tue Feb 18 02:56:46 PM CET 2025
Start of /etc/rc.local at Tue Feb 18 02:59:50 PM CET 2025
my_stdout_content
End of /etc/rc.local at Tue Feb 18 02:59:50 PM CET 2025
my_stderr_content
my_stderr_content
<details>
<summary><code>/etc/rc.local</code>:</summary>
```bash
#!/bin/sh
FOLDER_NAME=etc_rc_local
su --login benjamin_loison -c "
mkdir $FOLDER_NAME/
cd $FOLDER_NAME/
log() {
# Should ensure that date is not evaluated at script reading
echo `date` \"$@\"
}
(
log Start
(
echo my_stdout_content
echo my_stderr_content >&2
)
log End
) >> stdout.txt 2>> stderr.txt
"
```
</details>
```bash
cat etc_rc_local/std{out,err}.txt
```
<details>
<summary>Output:</summary>
```
Start of /etc/rc.local at Tue Feb 18 02:56:46 PM CET 2025
my_stdout_content
End of /etc/rc.local at Tue Feb 18 02:56:46 PM CET 2025
my_stderr_content
```
</details>
After a reboot:
```bash
cat etc_rc_local/std{out,err}.txt
```
<details>
<summary>Output:</summary>
```
Start of /etc/rc.local at Tue Feb 18 02:56:46 PM CET 2025
my_stdout_content
End of /etc/rc.local at Tue Feb 18 02:56:46 PM CET 2025
Start of /etc/rc.local at Tue Feb 18 02:59:50 PM CET 2025
my_stdout_content
End of /etc/rc.local at Tue Feb 18 02:59:50 PM CET 2025
my_stderr_content
my_stderr_content
```
</details>
#!/bin/sh
SCRIPT='/etc/rc.local'FOLDER_NAME=etc_rc_local
su --login benjamin_loison -c "
mkdir $FOLDER_NAME/
cd $FOLDER_NAME/
(
echo \"Start of $SCRIPT at `date`\"
(
while [ true ]
do
date
echo my_stdout_content
echo my_stderr_content >&2
sleep 1
done
)
echo \"End of $SCRIPT at `date`\"
) >> stdout.txt 2>> stderr.txt &
"
head -n 5 etc_rc_local/std{out,err}.txt
Output:
==> etc_rc_local/stdout.txt <==
Start of /etc/rc.local at Tue Feb 18 03:38:16 PM CET 2025
Tue Feb 18 03:38:17 PM CET 2025
my_stdout_content
Tue Feb 18 03:38:18 PM CET 2025
my_stdout_content
==> etc_rc_local/stderr.txt <==
my_stderr_content
my_stderr_content
my_stderr_content
my_stderr_content
my_stderr_content
<details>
<summary><code>/etc/rc.local</code>:</summary>
```bash
#!/bin/sh
SCRIPT='/etc/rc.local'
FOLDER_NAME=etc_rc_local
su --login benjamin_loison -c "
mkdir $FOLDER_NAME/
cd $FOLDER_NAME/
(
echo \"Start of $SCRIPT at `date`\"
(
while [ true ]
do
date
echo my_stdout_content
echo my_stderr_content >&2
sleep 1
done
)
echo \"End of $SCRIPT at `date`\"
) >> stdout.txt 2>> stderr.txt &
"
```
</details>
```bash
head -n 5 etc_rc_local/std{out,err}.txt
```
<details>
<summary>Output:</summary>
```
==> etc_rc_local/stdout.txt <==
Start of /etc/rc.local at Tue Feb 18 03:38:16 PM CET 2025
Tue Feb 18 03:38:17 PM CET 2025
my_stdout_content
Tue Feb 18 03:38:18 PM CET 2025
my_stdout_content
==> etc_rc_local/stderr.txt <==
my_stderr_content
my_stderr_content
my_stderr_content
my_stderr_content
my_stderr_content
```
</details>
#!/bin/sh
SCRIPT='/etc/rc.local'FOLDER_NAME=etc_rc_local
su --login benjamin_loison -c "
mkdir $FOLDER_NAME/
cd $FOLDER_NAME/
(
echo \"Start of $SCRIPT at `date`\"
autossh CENSORED_VPS -NR 2224:localhost:22
echo \"End of $SCRIPT at `date`\"
) >> stdout.txt 2>> stderr.txt &
"
cat etc_rc_local/std{out,err}.txt
Start of /etc/rc.local at Tue Feb 18 03:44:42 PM CET 2025
After a reboot:
cat etc_rc_local/std{out,err}.txt
Output:
Start of /etc/rc.local at Tue Feb 18 03:44:42 PM CET 2025
Start of /etc/rc.local at Tue Feb 18 03:45:39 PM CET 2025
<details>
<summary><code>/etc/rc.local</code>:</summary>
```bash
#!/bin/sh
SCRIPT='/etc/rc.local'
FOLDER_NAME=etc_rc_local
su --login benjamin_loison -c "
mkdir $FOLDER_NAME/
cd $FOLDER_NAME/
(
echo \"Start of $SCRIPT at `date`\"
autossh CENSORED_VPS -NR 2224:localhost:22
echo \"End of $SCRIPT at `date`\"
) >> stdout.txt 2>> stderr.txt &
"
```
</details>
```bash
cat etc_rc_local/std{out,err}.txt
```
```
Start of /etc/rc.local at Tue Feb 18 03:44:42 PM CET 2025
```
After a reboot:
```bash
cat etc_rc_local/std{out,err}.txt
```
<details>
<summary>Output:</summary>
```
Start of /etc/rc.local at Tue Feb 18 03:44:42 PM CET 2025
Start of /etc/rc.local at Tue Feb 18 03:45:39 PM CET 2025
```
</details>
Start of /etc/rc.local at Tue Feb 18 04:09:41 PM CET 2025
Start of /etc/rc.local at Tue Feb 18 04:09:41 PM CET 2025
would help figure out when an error occurs.
<details>
<summary><code>/etc/rc.local</code>:</summary>
```bash
#!/bin/sh
SCRIPT='/etc/rc.local'
FOLDER_NAME=etc_rc_local
su --login benjamin_loison -c "
mkdir $FOLDER_NAME/
cd $FOLDER_NAME/
(
echo \"Start of $SCRIPT at `date`\" | tee /dev/stderr
autossh CENSORED_VPS -NR 2224:localhost:22
echo \"End of $SCRIPT at `date`\" | tee /dev/stderr
) >> stdout.txt 2>> stderr.txt &
"
```
</details>
Source: [the Stack Overflow answer 6852984](https://stackoverflow.com/a/6852984)
```bash
cat etc_rc_local/std{out,err}.txt
```
<details>
<summary>Output:</summary>
```
Start of /etc/rc.local at Tue Feb 18 04:09:41 PM CET 2025
Start of /etc/rc.local at Tue Feb 18 04:09:41 PM CET 2025
```
</details>
would help figure out when an error occurs.
Start of /etc/rc.local at Tue Feb 18 04:24:02 PM CET 2025
End of /etc/rc.local at Tue Feb 18 04:24:02 PM CET 2025
End of /etc/rc.local at Tue Feb 18 04:24:02 PM CET 2025
If add -a to tee:
cat _etc_rc_local/std{out,err}.txt
Output:
Start of /etc/rc.local at Tue Feb 18 04:31:11 PM CET 2025
End of /etc/rc.local at Tue Feb 18 04:31:11 PM CET 2025
Start of /etc/rc.local at Tue Feb 18 04:31:11 PM CET 2025
End of /etc/rc.local at Tue Feb 18 04:31:11 PM CET 2025
Without `autossh`:
```bash
cat _etc_rc_local/std{out,err}.txt
```
<details>
<summary>Output:</summary>
```
Start of /etc/rc.local at Tue Feb 18 04:24:02 PM CET 2025
End of /etc/rc.local at Tue Feb 18 04:24:02 PM CET 2025
End of /etc/rc.local at Tue Feb 18 04:24:02 PM CET 2025
```
</details>
If add `-a` to `tee`:
```bash
cat _etc_rc_local/std{out,err}.txt
```
<details>
<summary>Output:</summary>
```
Start of /etc/rc.local at Tue Feb 18 04:31:11 PM CET 2025
End of /etc/rc.local at Tue Feb 18 04:31:11 PM CET 2025
Start of /etc/rc.local at Tue Feb 18 04:31:11 PM CET 2025
End of /etc/rc.local at Tue Feb 18 04:31:11 PM CET 2025
```
</details>
There is no need to wait 30 seconds after boot in my Virtual Machine Manager virtual machine to access it via SSH:
autossh --help 2>&1| grep AUTOSSH_FIRST_POLL
AUTOSSH_FIRST_POLL - time before first connection check (seconds)
man autossh
Output:
...
AUTOSSH_FIRST_POLL
Specifies the time to wait before the first connection test. Thereafter the general poll time is used (see AUTOSSH_POLL below).
...
AUTOSSH_POLL
Specifies the connection poll time in seconds; default is 600 seconds. Unless AUTOSSH_FIRST_POLL is used, the first poll time
will set to match the poll time. If the poll time is less than twice the network timeouts (default 15 seconds) the network time‐
outs will be adjusted downward to 1/2 the poll time.
...
these are the only references to AUTOSSH_FIRST_POLL and AUTOSSH_POLL.
So 30 seconds seems to just be make 600 seconds behavior happens faster.
There is no need to wait 30 seconds after boot in my Virtual Machine Manager virtual machine to access it via SSH:
```bash
autossh --help 2>&1 | grep AUTOSSH_FIRST_POLL
```
```
AUTOSSH_FIRST_POLL - time before first connection check (seconds)
```
```bash
man autossh
```
<details>
<summary>Output:</summary>
```
...
AUTOSSH_FIRST_POLL
Specifies the time to wait before the first connection test. Thereafter the general poll time is used (see AUTOSSH_POLL below).
...
AUTOSSH_POLL
Specifies the connection poll time in seconds; default is 600 seconds. Unless AUTOSSH_FIRST_POLL is used, the first poll time
will set to match the poll time. If the poll time is less than twice the network timeouts (default 15 seconds) the network time‐
outs will be adjusted downward to 1/2 the poll time.
...
```
</details>
these are the only references to `AUTOSSH_FIRST_POLL` and `AUTOSSH_POLL`.
So 30 seconds seems to just be make 600 seconds behavior happens faster.
I tested on my host Debian 12 GNOME laptop flat wifi:
/etc/rc.local:
#!/bin/sh
LOCAL_USER_NAME=benjamin_loison
SERVER_HOST_NAME=CENSORED_VPS
SERVER_PORT=2224SCRIPT="$0"FOLDER_NAME=`echo -n "$SCRIPT"| tr -c 'a-z' _`exportAUTOSSH_FIRST_POLL=30
su --login $LOCAL_USER_NAME --command "
mkdir $FOLDER_NAME/
cd $FOLDER_NAME/
(
echo \"Start of $SCRIPT at `date`\" | tee -a /dev/stderr
autossh $SERVER_HOST_NAME -NR $SERVER_PORT:localhost:22
echo \"End of $SCRIPT at `date`\" | tee -a /dev/stderr
) >> stdout.txt 2>> stderr.txt &
"
and it works fine without waiting 30 seconds.
I tested on my host Debian 12 GNOME laptop flat wifi:
<details>
<summary><code>/etc/rc.local</code>:</summary>
```bash
#!/bin/sh
LOCAL_USER_NAME=benjamin_loison
SERVER_HOST_NAME=CENSORED_VPS
SERVER_PORT=2224
SCRIPT="$0"
FOLDER_NAME=`echo -n "$SCRIPT" | tr -c 'a-z' _`
export AUTOSSH_FIRST_POLL=30
su --login $LOCAL_USER_NAME --command "
mkdir $FOLDER_NAME/
cd $FOLDER_NAME/
(
echo \"Start of $SCRIPT at `date`\" | tee -a /dev/stderr
autossh $SERVER_HOST_NAME -NR $SERVER_PORT:localhost:22
echo \"End of $SCRIPT at `date`\" | tee -a /dev/stderr
) >> stdout.txt 2>> stderr.txt &
"
```
</details>
and it works fine without waiting 30 seconds.
sudo su --login benjamin_loison -c "
log() {
# Should ensure that date is not evaluated at script reading
echo `date` \"$@\"
}
log test
"
Sat 22 Feb 10:42:01 CET 2025
<details>
<summary>Bash script:</summary>
```bash
sudo su --login benjamin_loison -c "
log() {
# Should ensure that date is not evaluated at script reading
echo `date` \"$@\"
}
log test
"
```
</details>
```
Sat 22 Feb 10:42:01 CET 2025
```
<details>
<summary>Bash script:</summary>
```bash
log() {
# Should ensure that date is not evaluated at script reading
echo `date` \"$@\"
}
log hey
sudo su --login benjamin_loison -c "
log test
"
```
</details>
```
Sat 22 Feb 10:47:30 CET 2025 "hey"
-bash: line 2: log: command not found
```
Maybe `export` may help as it may help with `AUTOSSH_FIRST_POLL`.
See [Benjamin_Loison/util-linux/issues/7](https://codeberg.org/Benjamin_Loison/util-linux/issues/7).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Output:
Would help Benjamin_Loison/openssh/issues/20.
/etc/rc.local:does not return anything on reboot.
Let us add:
to see if boot stays stuck as
&usage seems to suggest.Benjamin_Loison/coreutils/issues/19 would help.
Well it is not, so maybe the permissions are to blame.
is expected.
I have:
However, permanent with date logs would be nice.
may help.
Output:
so this folder looks already quite full.
works as wanted.
/etc/rc.local:Output:
After a reboot:
Output:
while [ true ]makes the boot stuck.Shell:
Shell:
log.txtcorrectly get filled./etc/rc.local:Output:
/etc/rc.local:After a reboot:
Output:
Tested on Debian 12 GNOME.
/etc/rc.local:Source: the Stack Overflow answer 6852984
Output:
would help figure out when an error occurs.
Let us not add
tail -c +2to be precise, despite being less clean in this case.Source: the Stack Overflow question 51877092.
Without
autossh:Output:
If add
-atotee:Output:
/etc/rc.local:results in:
So
envdoes not mention it butAUTOSSH_FIRST_POLLis correctly set within-c.There is no need to wait 30 seconds after boot in my Virtual Machine Manager virtual machine to access it via SSH:
Output:
these are the only references to
AUTOSSH_FIRST_POLLandAUTOSSH_POLL.So 30 seconds seems to just be make 600 seconds behavior happens faster.
I tested on my host Debian 12 GNOME laptop flat wifi:
/etc/rc.local:and it works fine without waiting 30 seconds.
Bash script:
Bash script:
Maybe
exportmay help as it may help withAUTOSSH_FIRST_POLL.See Benjamin_Loison/util-linux/issues/7.