Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

    Empty Recycle bin after x Days via Cron script

    Kopano Groupware Core
    3
    12
    478
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • zash1958
      zash1958 last edited by

      Hi,

      as stated above. We want to empty the recycle bin after x Days via cron script automagically. In Zarafa there was an appropriate Python script for doing this.

      We found here

      https://stash.kopano.io/projects/KSC/repos/core-tools/browse/kopano-cleanup

      a script for doing this in Kopano. But the script claims

      Traceback (most recent call last):
      File “./cleanup.py”, line 8, in <module>
      import kopano
      ImportError: No module named kopano

      What is missing here and what can we do?

      TIA

      Uwe

      1 Reply Last reply Reply Quote 0
      • thctlo
        thctlo last edited by

        Try installing python3-kopano and then try again.

        fbartels 1 Reply Last reply Reply Quote 0
        • fbartels
          fbartels Kopano @thctlo last edited by

          @thctlo said in Empty Recycle bin after x Days via Cron script:

          python3-kopano

          since the shebang is # !/usr/bin/env python its probably rather python-kopano (the python2 variant) that is missing.

          Regards Felix

          Resources:
          https://kopano.com/blog/how-to-get-kopano/
          https://documentation.kopano.io/
          https://kb.kopano.io/

          Support overview:
          https://kopano.com/support/

          1 Reply Last reply Reply Quote 0
          • zash1958
            zash1958 last edited by

            Hmmmhhhhhh ???

            ***apt-get install python-kopano
            Paketlisten werden gelesen… Fertig
            Abhängigkeitsbaum wird aufgebaut.
            Statusinformationen werden eingelesen… Fertig
            Einige Pakete konnten nicht installiert werden. Das kann bedeuten, dass
            Sie eine unmögliche Situation angefordert haben oder, wenn Sie die
            Unstable-Distribution verwenden, dass einige erforderliche Pakete noch
            nicht erstellt wurden oder Incoming noch nicht verlassen haben.
            Die folgenden Informationen helfen Ihnen vielleicht, die Situation zu lösen:

            Die folgenden Pakete haben unerfüllte Abhängigkeiten:
            python-kopano : Hängt ab von: python-mapi soll aber nicht installiert werden
            E: Probleme können nicht korrigiert werden, Sie haben zurückgehaltene defekte Pakete.***

            fbartels 1 Reply Last reply Reply Quote 0
            • fbartels
              fbartels Kopano @zash1958 last edited by

              @zash1958 you are sadly not sharing which versions you are using. the message you get could have multiple causes. for example because packages in our repo have been updated meanwhile and you local packages would need to be updated (since python-kopano depends on a newer version of python-mapi than you have currently installed).

              Regards Felix

              Resources:
              https://kopano.com/blog/how-to-get-kopano/
              https://documentation.kopano.io/
              https://kb.kopano.io/

              Support overview:
              https://kopano.com/support/

              1 Reply Last reply Reply Quote 0
              • thctlo
                thctlo last edited by thctlo

                @zash1958 said in Empty Recycle bin after x Days via Cron script:

                python-kopano : Hängt ab von: python-mapi soll aber nicht installiert werden
                E: Probleme können nicht korrigiert werden, Sie haben zurückgehaltene defekte Pakete.***

                hmm,

                https://github.com/thctlo/Kopano and get the file : wget -O - https://raw.githubusercontent.com/thctlo/Kopano/master/get-kopano-community.sh | bash
                This script pull the community files for your OS and setup a repo so you can use apt-get to install.

                So get the script, run it, then type : apt-get -f install or dpkg-reconfigure -a

                fbartels 1 Reply Last reply Reply Quote 0
                • fbartels
                  fbartels Kopano @thctlo last edited by

                  @thctlo said in Empty Recycle bin after x Days via Cron script:

                  and setup a repo

                  his error message above makes it seem that he already has a repository, but he rather has some dependency issues.

                  Regards Felix

                  Resources:
                  https://kopano.com/blog/how-to-get-kopano/
                  https://documentation.kopano.io/
                  https://kb.kopano.io/

                  Support overview:
                  https://kopano.com/support/

                  thctlo 1 Reply Last reply Reply Quote 0
                  • thctlo
                    thctlo @fbartels last edited by

                    @fbartels i’ll bet he used dpkg -i *.deb
                    As far i’ve seen there are not dependency issues atm in kopano.
                    This at least makes sure all needed packages are available.

                    fbartels 1 Reply Last reply Reply Quote 0
                    • fbartels
                      fbartels Kopano @thctlo last edited by

                      @thctlo said in Empty Recycle bin after x Days via Cron script:

                      i’ll bet he used dpkg -i *.deb

                      his logging suggests otherwise:

                      @zash1958 said in Empty Recycle bin after x Days via Cron script:

                      apt-get install python-kopano

                      @thctlo said in Empty Recycle bin after x Days via Cron script:

                      there are not dependency issues atm in kopano.

                      my money is on a difference between the already installed packages and the packages currently available from the repository.

                      Regards Felix

                      Resources:
                      https://kopano.com/blog/how-to-get-kopano/
                      https://documentation.kopano.io/
                      https://kb.kopano.io/

                      Support overview:
                      https://kopano.com/support/

                      1 Reply Last reply Reply Quote 0
                      • thctlo
                        thctlo last edited by thctlo

                        hmmm… i’ve just tested this. Debian stretch.

                         python kopano-cleanup.py
                        Traceback (most recent call last):
                          File "kopano-cleanup.py", line 8, in <module>
                            import kopano
                        ImportError: No module named kopano
                        
                        python3 kopano-cleanup.py
                        Please use:
                         {} --user <username> --days <days>  kopano-cleanup.py
                        
                        chmod +x kopano-cleanup.py
                        ./kopano-cleanup.py
                        ./kopano-cleanup.py: line 5: import: command not found
                        from: can't read /var/mail/datetime
                        ./kopano-cleanup.py: line 7: import: command not found
                        ./kopano-cleanup.py: line 8: import: command not found
                        from: can't read /var/mail/MAPI.Util
                        ./kopano-cleanup.py: line 12: syntax error near unexpected token `('
                        ./kopano-cleanup.py: line 12: `    def _encode(s):'
                        

                        I’ll have a better look here.

                        dpkg -l | grep kopano|grep python
                        ii  kopano-python-utils                             8.7.80.827.cd49bb60b-0+150.1               amd64        Additional Python-based command-line utils for Kopano Core
                        ii  python3-kopano                                  8.7.80.827.cd49bb60b-0+150.1               all          High-level Python 3 bindings for Kopano
                        ii  python3-kopano-search                           8.7.80.827.cd49bb60b-0+150.1               all          Kopano search module for Python 3
                        ii  python3-kopano-utils                            8.7.80.827.cd49bb60b-0+150.1               all          Kopano utils modules for Python 3
                        
                        apt-get install python-kopano
                        

                        and try again …

                        ./kopano-cleanup.py
                        ./kopano-cleanup.py: line 5: import: command not found
                        from: can't read /var/mail/datetime
                        ./kopano-cleanup.py: line 7: import: command not found
                        ./kopano-cleanup.py: line 8: import: command not found
                        from: can't read /var/mail/MAPI.Util
                        ./kopano-cleanup.py: line 12: syntax error near unexpected token `('
                        ./kopano-cleanup.py: line 12: `    def _encode(s):'
                        
                        root@mail1:/etc/kopano/bin# python kopano-cleanup.py
                        ('Please use:\n {} --user <username> --days <days> ', 'kopano-cleanup.py')
                        
                        root@mail1:/etc/kopano/bin# python3 kopano-cleanup.py
                        ('Please use:\n {} --user <username> --days <days> ', 'kopano-cleanup.py')
                        
                        1 Reply Last reply Reply Quote 0
                        • thctlo
                          thctlo last edited by thctlo

                          ok found it.

                          edit kopano-cleanup.py

                          The fist line :

                          # !/usr/bin/env python
                          

                          changed to

                          #!/usr/bin/env python
                          

                          just remove the space after #

                          now after chmod +x , it works with ./kopano-cleanup.py
                          and, you must install : python-kopano python-mapi

                          it does not work when only : python3-kopano python3-mapi are installed.

                          This is due Debian stretch its default :

                          ls -al /usr/bin/python
                          lrwxrwxrwx 1 root root 9 Jan 24  2017 /usr/bin/python -> python2.7
                          
                          

                          But it does work fine, if you dont install python-kopano python-mapi and change python to python3 in the first line.

                          1 Reply Last reply Reply Quote 0
                          • zash1958
                            zash1958 last edited by

                            Thank You!!!

                            running

                            python3 ./cleanup.py --user xxx

                            runs perfectly !

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post