Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../lib/svc/share/migrate_var_user.py
Real path: /lib/svc/share/migrate_var_user.py
Zurück
#!/usr/bin/python3.7 -Es import solaris.no_site_packages # # Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. # """ Migrate /var/user/<username> /var/user/<uid> and leave behind a symlink /var/user/<username> that points to /var/user/<uid> This needs to be idempotent so that it can be run multiple times if a system is rebooted backwards and fowards between multiple BEs. """ import os _PATH_VARUSER = "/var/user" os.chdir(_PATH_VARUSER) for ud in [d for d in os.listdir(_PATH_VARUSER) if os.path.isdir(d) and not os.path.islink(d)]: try: owner = str(os.stat(ud).st_uid) if ud != owner: os.rename(ud, owner) os.symlink(owner, ud) except OSError: continue