michaelhoch

Q: Delete active tasks in ProfileManager

Can I delete active tasks in the profilemanager? There are over 500 of them, and it stopped pushing to the devices.

Is there a command line for batch deleting?

Posted on Jan 24, 2012 8:49 AM

Close

Q: Delete active tasks in ProfileManager

  • All replies
  • Helpful answers

  • by Newham Bridge Administrator,

    Newham Bridge Administrator Newham Bridge Administrator Jun 7, 2013 7:02 AM in response to michaelhoch
    Level 1 (0 points)
    Jun 7, 2013 7:02 AM in response to michaelhoch

    23 people at the time of writing have this question too. We need a Cancel All button in the next version of Profile Manager.

    Either that or we need Profile Manager to do its job and actually push to profiles that it's supposed to!

  • by Tearjerker,

    Tearjerker Tearjerker Dec 17, 2013 6:24 AM in response to michaelhoch
    Level 1 (59 points)
    Dec 17, 2013 6:24 AM in response to michaelhoch

    1. Launch the Terminal on the PM Server.  You’ll find it in the Utilities folder under Applications.

    2. Copy and paste in the following command.  This command accesses the database that Profile Manager stores all of its data in and erases all of the tasks.

    sudo psql -h "/Library/Server/PostgreSQL For Server Services/Socket" -U _postgres -d device_management -c "TRUNCATE TABLE tasks;"

    3. You will be asked for your password.  Type it in and press enter.

  • by Geuzencollege,

    Geuzencollege Geuzencollege Jan 20, 2014 6:27 AM in response to Tearjerker
    Level 1 (0 points)
    Jan 20, 2014 6:27 AM in response to Tearjerker

    When i use your command:

    sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "DELETE FROM library_item_tasks WHERE completed_at IS NOT NULL"

     

    It says:

    psql: could not connect to server: No such file or directory

        Is the server running locally and accepting

        connections on Unix domain socket "/Library/Server/PostgreSQL For Server Services/Socket/.s.PGSQL.5432"?

     

    When i use this command:

    sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "DELETE FROM library_item_tasks WHERE completed_at IS NOT NULL"

     

    It says:

    DELETE 0

     

    Now when i go to Profile Manager there are still 200 active tasks running...

    What i do wrong ?

  • by Tearjerker,

    Tearjerker Tearjerker Jan 20, 2014 6:36 AM in response to Geuzencollege
    Level 1 (59 points)
    Jan 20, 2014 6:36 AM in response to Geuzencollege

    sudo psql -h "/Library/Server/PostgreSQL For Server Services/Socket" -U _postgres -d device_management -c "TRUNCATE TABLE tasks;"

     

     

    Your commands were wrong....

     

    Best

  • by Geuzencollege,

    Geuzencollege Geuzencollege Jan 20, 2014 7:31 AM in response to Tearjerker
    Level 1 (0 points)
    Jan 20, 2014 7:31 AM in response to Tearjerker

    Hi Taerjerker,

    Maybe u can explain me what i am doing wrong ?

     

    This command works for me:

    sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "DELETE FROM library_item_tasks WHERE completed_at IS NOT NULL"

     

    But i still see the active tasks in Profile Manager...

  • by Tearjerker,

    Tearjerker Tearjerker Jan 20, 2014 7:33 AM in response to Geuzencollege
    Level 1 (59 points)
    Jan 20, 2014 7:33 AM in response to Geuzencollege

    Hi!

     

    Please try this command:

     

    sudo psql -h "/Library/Server/PostgreSQL For Server Services/Socket" -U _postgres -d device_management -c "TRUNCATE TABLE tasks;"

     

    It works great for me...

     

    Best

  • by Geuzencollege,

    Geuzencollege Geuzencollege Jan 20, 2014 9:59 AM in response to Tearjerker
    Level 1 (0 points)
    Jan 20, 2014 9:59 AM in response to Tearjerker

    Hi Tearjerker,

     

    Thank you for your fast reply.

     

    When i use your command it gives the following message:

     

    psql: could not connect to server: No such file or directory

        Is the server running locally and accepting

        connections on Unix domain socket "/Library/Server/PostgreSQL For Server Services/Socket/.s.PGSQL.5432"?

     

    ( sorry, i copy paste it wrong in my first message, i have try this command before ).

  • by Morgs,

    Morgs Morgs Feb 17, 2014 4:55 PM in response to Tearjerker
    Level 1 (11 points)
    Feb 17, 2014 4:55 PM in response to Tearjerker

    Hello All,

     

    Is someone able to explain what is going on when you do this?

     

    Is it wise?

    Should any actions post be taken?

     

    Thanks

    Morgs

  • by gunnar514,

    gunnar514 gunnar514 May 25, 2016 7:10 PM in response to Geuzencollege
    Level 1 (4 points)
    May 25, 2016 7:10 PM in response to Geuzencollege

    Hi there, this is because the command given clears COMPLETED tasks.
    To delete ACTIVE tasks, use:

     

    sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "DELETE FROM library_item_tasks WHERE completed_at IS NULL"

     

    The difference is between the "IS NULL" and "IS NOT NULL".

     

    Cheers!