Expecto not working under crontab

My expect scripts work smoothlessly if executed under my user, however the scripts dont work correctly when triggered from the crontab, they work for all the sentences unless the expect ones, somehow its is not working.

What can be going wrong?
LVL 1
celticianAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

woolmilkporcCommented:
I strongly assume that this is due to missing paths to executables (scripts, commands ...)

Specify full paths to all executables which are not in /usr/bin, like "/path/to/scriptname" instead of "./scriptname" etc., in your case maybe "/home/user/scripts/sftpER_v1.sh" instead of "./sftpER_v1.sh".

Reason: cron does not supply the full user environment, like PATH etc.,
because it doesn't execute the user's initialization files (".bashrc", ".profile", ..., ...)

You could post your final script version(s) here, so we can have a closer look.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
celticianAuthor Commented:
oh ok im gonna try it now :)
MikeOM_DBACommented:
woolmilkporc is absolutely correct, you need to set your environment (.profile) in order for all to work as if  executed under your user.

Just add "(dot). ~/.profile " as first statement in your script.
celticianAuthor Commented:
It worked fine, i had to set absolute routes to make it work. thank you!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.