You are not logged in.
I have the following on my /etc/fstab:
tmpfs /tmp-workspace tmpfs defaults,size=8G,nodev,nosuid,uid=root,gid=root,mode=1777,rw 0 0I would like to place some default content immediately upon startup (including /home/*/.cache directories, browser's cache directories, and the like). I can think of at least two possible ways of automating what I am manually doing right now:
- properly coding a stand-alone systemd service unit that triggers on /tmp-workspace successful mount
- add systemd extensions to the mount line in fstab with ExecStart and the like (leaving the magic to the systemd generator)
Either way, I suppose if [Install] WantedBy=multi-user.target is present will guarantee that mounting /home will grant me everything on my RAM drive will be right in place (multi-user.target) ... am I right ?
Pros/Cons/Advice please ?
Offline
Care to share what you're "manually doing right now"?
Offline
Care to share what you're "manually doing right now"?
Sure. But I think it is totally irrelevant: I am manually executing the following BASH script under root upon startup before login-in with any other user:
typeset strUserName='root';
if /usr/bin/test "${USER}" = "${strUserName}"; then ### a self-imposed restriction
readonly strPATHROOT='/';
readonly strPATHNAME='tmp-workspace';
if /usr/bin/test '['$(/usr/bin/findmnt --noheadings --output='TARGET' --mountpoint="${strPATHROOT}${strPATHNAME}")']' = "[${strPATHROOT}${strPATHNAME}]"; then
readonly strPATH="${strPATHROOT}${strPATHNAME}/";
readonly -a strFSOdirectories=( \
"root root 755 ${strPATH}cache" \
"root root 700 ${strPATH}cache/users" \
"root root 700 ${strPATH}cache/users/root" \
"user1 stuff 700 ${strPATH}cache/users/user1" \
"user2 stuff 700 ${strPATH}cache/users/user2" \
"user3 stuff 700 ${strPATH}cache/users/user3" \
"user4 stuff 700 ${strPATH}cache/users/user4" \
"user1 stuff 750 ${strPATH}setup" \
"user1 stuff 750 ${strPATH}setup/build" \
"user1 stuff 750 ${strPATH}setup/build-logs" \
"user1 stuff 750 ${strPATH}setup/build-packages" \
); ### space delimited: owner group mode path
typeset strFSO='';
for strFSO in "${strFSOdirectories[@]}"; do
typeset strFSOUID=$(echo "${strFSO}" | /usr/bin/awk -F ' ' '{ print $1 }');
typeset strFSOGID=$(echo "${strFSO}" | /usr/bin/awk -F ' ' '{ print $2 }');
typeset strFSOMOD=$(echo "${strFSO}" | /usr/bin/awk -F ' ' '{ print $3 }');
typeset strFSODIR=$(echo "${strFSO}" | /usr/bin/awk -F ' ' '{ print $4 }');
if /usr/bin/test ! -d "${strFSODIR}"; then
/usr/bin/printf "creating directory [${strFSODIR}]\n";
/usr/bin/mkdir --mode="${strFSOMOD}" "${strFSODIR}";
fi;
if /usr/bin/test -d "${strFSODIR}"; then
/usr/bin/chown "${strFSOUID}:${strFSOGID}" "${strFSODIR}";
fi;
unset -v strFSODIR;
unset -v strFSOMOD;
unset -v strFSOGID;
unset -v strFSOUID;
done;
unset -v strFSO;
else
/usr/bin/printf "ooops … ${colorOOOPS}missing mount${colorDEFAULT}: [${colorVALUE}${strPATH}${colorDEFAULT}]\n";
fi;
else
/usr/bin/printf "ooops … ${colorOOOPS}executing with wrong user${colorDEFAULT}: [${colorVALUE}${USER}${colorDEFAULT}]≠[${colorVALUE}${strUserName}${colorDEFAULT}] … a self-imposed restriction\n";
fi;
unset -v strUserName;Offline
Will check it, thanks for the link, I have it in mind but got unexpectedly busy the past week.
Offline