Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1016433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:32:56+00:00 2026-05-16T10:32:56+00:00

I have a strange issue, relating to running a BASH script via cron (invoked

  • 0

I have a strange issue, relating to running a BASH script via cron (invoked via crontab -e).

Here is the script:

#!/bin/bash

SIG1="$(iwconfig wlan0 | awk '/Quality=/ { print $2} ' | cut -c 9-10)"
SIG2="$(iwconfig wlan0 | awk '/Quality=/ { print $2} ' | cut -c 12-13)"

echo "$SIG1:$SIG2" >> test.txt
exit

When run from the commandline, I get the expected output of 45:70 echoed to the end of the text file. However, when I run the script via cron (using crontab -e) and the following entry:

* * * * * bash /home/rupert/test.sh

I just get the colon (:) echoed to the text file, the values SIG1 and SIG2 aren’t created and I have no idea why. Why would running via cron mess up the script?

FWIW, here is the output of iwconfig wlan0 with no additional processing:

wlan0     IEEE 802.11abgn  ESSID:"plumternet"
          Mode:Managed  Frequency:2.452 GHz  Access Point: 00:18:84:2A:68:AD
          Bit Rate=54 Mb/s   Tx-Power=15 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=46/70  Signal level=-64 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

I am doing all this because I want to display the WiFi Link Quality value “46/70” on an LCD screen and the program I use does this by reading a text file. However, when run via cron, the values get lost…???

I am using cut -c 9-10 and cut -c 12-13 because I was thinking the “/” might be causing an issue in the script, I’d be happy to just use cut -c 9-13, but I thought it might fix the issue, but it didn’t.

Help!!

Cool, thanks to you guys, I realised it was a PATH problem, simply giving the full path to iwconfig (/sbin/iwconfig) fixed it. Here is a pic of the LCD screen now showing all the correct info:

http://img835.imageshack.us/img835/4175/20100825122413.jpg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:32:57+00:00Added an answer on May 16, 2026 at 10:32 am

    you need to give the full path to any commands executed via cron. cron runs commands detached from any terminal which means you need to set the environment correctly. cut is probably available but give the absolute path to iwconfig and awk

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.