LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Need to write a shell script which checks a licence file (https://www.linuxquestions.org/questions/linux-kernel-70/need-to-write-a-shell-script-which-checks-a-licence-file-4175434291/)

vishnuj 10-26-2012 10:13 PM

Need to write a shell script which checks a licence file
 
Please suggest me a script which needs to check the expiration date of a license file in some location and an automated email should triggered to the mentioned mail id if the expiration date in the license file is less than or equal to 60 days

syg00 10-26-2012 10:19 PM

How about you write the script, and if you have problems maybe we can help then.

sundialsvcs 10-29-2012 05:02 PM

I suggest that you will need to write a binary program that checks the license in some way, and which perhaps returns a zero or non-zero return code that tells an outer level script what to do. Presumably, this program would invoke the same API (e.g. a library) that the license-controlled applications would also use.

This arrangement ensures that the script verifies the license information in the same way that the applications do, using the same underlying code (and without revealing it). The script then goes on to do what it alone should do, namely, send an e-mail somewhere.

(Incidentally, don't presume that you must use "bash scripting" to do this sort of thing. In Unix/Linux, you can use any one of half-a-dozen scripting tools which are truly built to be such tools. All of them work equally well as "shell scripts," thanks to the clever voodoo magic of #!shebang.

It also strikes me that this ought to be a very-common requirement such that you can purchase (or find open-source) a suitable program with which to do it. I've seen several applications which simply used a public-key encrypted file containing license information: the library contained the public key, used to decrypt the license-file and to in so doing verify its authenticity. But, you shouldn't have to write such a thing from scratch.

(Also: my comment about license techniques is that of a friend who kept an expensive guitar in a cardboard case with a tiny lock on it ... "to keep the honest people out." And it works, even if a slightly-determined hacker "could" defeat it; even if he could defeat it comparatively easily. The most-important consideration for your scheme literally is that it is there, and that it does not get in the way of day-to-day honest usefulness.)


All times are GMT -5. The time now is 08:22 PM.