PGP encryption issue with Crontab

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
    PGP encryption works manually but not with crontab

  2. Relevant commands, code, scripts, algorithms:
    Below Command works fine manually
    pgp --encrypt $file_path --recipient "publickey" -v --home-dir /$HOME/alice/.pgp/
    But the same command when included in a test.sh and scheduled through crontab, it gives "pgp: not found" error

  3. The attempts at a solution (include all code and scripts):

I assume that crontab kicks off with root user and the root user is unable to find the location of pgp installed in the user alice.
Specified --home-dir argument explicitly, even then it didn't work.

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    WIP, IL, USA

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

This problem is so common it's in our FAQ.

cron runs with a very minimal PATH. Try /absolute/path/to/php instead of just pgp.

Thanks for the reply Corona688.
Tried it with absolute path /opt/pgp/bin/pgp, manually it works. But, with crontab it gives ld.so.1: pgp: fatal: relocation error: file /opt/pgp/lib/libstdc++.so.6: referenced symbol not found.
Further, I tried to set environment variable $LD_LIBRARY_PATH to include /opt/pgp/bin using below command:
set $LD_LIBRARY_PATH = /opt/pgp/lib:$LD_LIBRARY_PATH.
Still the LD_LIBRARY_PATH value remains the same (It's not updated)
Please suggest

Hmmm. Trickier, if it's installed in /opt. Do you have LD_LIBRARY_PATH set in your shell? What does ldd /opt/pgp/bin/pgp print?

What shell are you running under?

csh uses "setenv VAR value" (note the lack of an "="...), bash/sh uses "VAR=value; export VAR".

I have no idea what "set $LD_LIBRARY_PATH=..." does.