The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

fixInboxLock Version 1.0

Discussion in 'cPanel Developers' started by rs-freddo, Dec 16, 2004.

  1. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    copy and paste the above into a file and run from cron every 20 minutes!
    This script checks for all email inbox.lock files in /home.
     
    #1 rs-freddo, Dec 16, 2004
    Last edited: Dec 17, 2004
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Good job :)

    Just a thought, though. IIRC the lock file simply contains the PID of the cppop process that is using it. If that process doesn't exist, it's no longer required. So, wouldn't a simple check on whether that pid contained in the lock file is active be enough - if it isn't delete the lock file, since it's no being accessed. then you don't need to worry about the timing element.

    Edit: Thinking about it a little more...is the idea just to basically kill off cppop processes that have a lock outstanding for more than the time set?
     
  3. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    Updated above script to stop "unary operater expected" error.

    I don't know the best way to do it. I only know the above works well. This above is an updated script I have posted before. This new script checks for all inbox.lock files instead of just those designated. Today i just got fed up with handling these locked up email support requests.
     
  4. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    That's basically when I write most of my scripts. I get tired of doing something over and over again and decide it's time to make it easier.
     
  5. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    Not Recommended

    It it not recommend to use this script while any mail is being checked/delivered as removing lock files while cppop/imap/exim is writing to mailbox WILL CAUSE MAILBOX corruption.

    Shut down exim, cppop and imap before you do this or you may end up with corrupted mail boxes.

    You might want to make the timeout to about 5000 seconds as people on dialup will have a lock for more then 1200 if they have a large inbox to mitigate this.
     
  6. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    Nobody would need to use this script if the issue was fixed - it's been hanging around now for at least 6 months.
     
  7. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    What is the bugzilla id ?
     
  8. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    Generally this should only happen if exim,cppop, or imap is running during a server reboot/crash and doesn't have enough time to die properly.

    Is anyone having the problem in another other event ?
     
  9. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    http://forums.cpanel.net/search.php?query=inbox.lock
    Most of these posts are before Bugzilla, therefore no bugzilla number.
     
    #9 rs-freddo, Dec 17, 2004
    Last edited: Dec 17, 2004
  10. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    It seems to be the concensus that the problem occurs when a client opens webmail while Outlook Express is collecting email. I don't know why it happens I just know that it does happen and has nothing to do with rebooting. Most of my clients are beginners so it seems to happen a lot. I never know whether they simply can't configure their email client or their inbox is locked...

    Would be nice to have this fixed, if not urgent, then tell me a better way and I'll code it.
     
  11. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider

    Do you know which webmail app causes this? Can you make it happen on demand (replication)?
     
  12. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    No I cannot replicate this. It just seems to happen to some accounts. I have had discussions with one person it happens to a lot. They claim that they don't use webmail and Outlook together. Beats me.
     
  13. jester.ro

    jester.ro Well-Known Member
    PartnerNOC

    Joined:
    Feb 6, 2004
    Messages:
    304
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Bucharest, Romania
    cPanel Access Level:
    DataCenter Provider
    well, i use this in cron:

    */60 * * * * find /home/*/mail -iname '*.lock' -exec rm '{}' ';'

    so i just delete the locks every hour. i have mailperm run every 10 minutes.

    i've been running like this fro 1-2 months, noone complained of mailbox corruption.

    Anyway, few cpanel versions ago, i updated to edge specially for this inbox.lock fix. Needless to say it didn't help, so i came to this drastic solution.

    I have customers that only use webmail, and still get this inbox.lock left overs. I first thought it was only related to simultaneosly checking mail width pop3 and imap client, but...NO.

    so untill i see this fixed...rm inbox.lock seems to do the trick.
     
  14. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    With this you'd be deleting inbox.lock files that might be only seconds old. My script is better. Last night I had one inbox.lock deleted that belongs to a client with a 10mb email (zipped software). So I have adjusted my script to delete only inbox.lock over 2 hours old (7200 seconds).

    Nick, I think their are a lot of people out there who are using different inbox.lock solutions. If you don't fix the problem we have to continue to use our solutions.

    I have been deleting inbox.lock files for one client that were over 10 minutes old for over 6 months without corrupting their email box. I agree with you corruption could occur, but I have to balance that with providing a reliable email service.
     
  15. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    The way cppop behaves has been changed in edge. I hope this resolves this.

    On a side note, I have a blackberry, ogo, 3 laptops and 3 desktops checking my mail every 10 mins and I've yet have a problem with inbox.lock.
     
  16. jester.ro

    jester.ro Well-Known Member
    PartnerNOC

    Joined:
    Feb 6, 2004
    Messages:
    304
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Bucharest, Romania
    cPanel Access Level:
    DataCenter Provider
    one question nick.

    my cpanel is now 9.9.9 S11, on fedora 1.

    when i first installed it, it was months ago (i believe it was 9.4 ). Could this be the reason?

    you don't see this behaviour cose you're probably using a new version(after inbox.lock has ben fixed), and we have problems cose we have old versions upgraded to latest?
     
  17. fusioncroc

    fusioncroc Well-Known Member

    Joined:
    Sep 28, 2004
    Messages:
    261
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    U.K.
  18. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    I've never had a problem with this either. But you and I know what we are doing. Some of the things my customers do, absolutely amaze me! I write software for a living too, and you really have to code for the lowest common denominator.
     
  19. jester.ro

    jester.ro Well-Known Member
    PartnerNOC

    Joined:
    Feb 6, 2004
    Messages:
    304
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Bucharest, Romania
    cPanel Access Level:
    DataCenter Provider
    come now, let's not blame the users for this :))

    i only have one email account on that cpanel box, and i ONLY check it with thunderbird (imap, tbird for linux), and sometimes i experience this inbox.lock problem.

    PS. i don't think is related to checking email during shutdown sequence either. The server i have problems with doesn't get rebooted :). Only rebooted it 3 times in 7 months.(2 kernel upgrades, and 1 hdd add-on).
     
  20. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
Loading...

Share This Page