In Linux-box I use
, How can I implement it in FreeBSD without sudo?
Code:
sudo -u username cmd
sudo -u username cmd
su -l postgres -c "/usr/local/bin/initdb --encoding=utf-8 --lc-collate=C -D /var/db/postgres/data11 "
su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data10/ -B /usr/local/bin/ -D /var/db/postgres/data11/ "
su -l postgres -c "/var/db/postgres/analyze_new_cluster.sh"
It's good idea and I testet withHere's an example where you have to run a command with another user:
su -l p2p -c "touch /tmp/ssss"
# ls -l /tmp/ssss
-rw-r--r-- 1 p2p wheel 0 Feb 23 15:49 /tmp/ssss