Direct answer to your question:
You can use the lid switch to trigger a script that stops the Crashplan service. See Laptop Lid and Dock Scripts on the Help Wiki.
Also see comments and answers of Catch lid close and open events.
There are also a bunch of examples for scripts written for different kinds of events people wanted to trigger with the lid switch in the Ubuntu Forums--a bit chaotic, but the examples could be helpful as you write yours.
However, it may not actually be Crashplan that is the problem.
If your swap drive is encrypted, that could actually be what is interfering with hibernation. (In a way, Crashplan may have indirectly been the cause--I'll explain more...) You may not have knowingly set up an encrypted swap drive; this happens automatically when you choose to encrypt your home directory during installation of Ubuntu 9.10 and above.
Furthermore, you may never have noticed that your swap partition was encrypted because you would still have the ability to hibernate if your fstab identifies your swap space by UUID.
This only becomes a problem when your swap drive fills up (which it very likely might have done while you were running Crashplan, since many of its processes like file restores are long and resource/memory-intensive). When full, everything about the encrypted swap is overwritten, including UUID, so upon attempting to wake up from hibernation, your system wouldn't know where to find your swap drive--it would be searching for a UUID that didn't exist anymore.
So you may not need to write a "stop service" script activated by the lid switch at all. You may just need to deal with your swap.
Two possibilities are:
Modifying your settings so that your swap drive is identified by /dev/sdXX
instead of by UUID and also the system is supplied with a randomly generated key when needed (/dev/urandom
). See this answer for explicit instructions. It involves editing crypttab and fstab, both of which you should back up before changing.
Opting for unencrypted swap. Obviously, the latter is not a recommended solution, but personally I think that for the average user, it's not a huge deal to have an unencrypted swap partition. You can read more about it and decide for yourself. See here for instructions on how to do that.
Also see the Ubuntu Help Wiki on the caveats of encrypted home and how hibernation is affected.
Note: This question is 2 years old, so even though it would be best to get more information before answering, I thought it was unlikely the OP would respond, so I went ahead and posted an answer.